refactor: rename responsavel to recurso throughout data models, repository, and UI layers
This commit is contained in:
@@ -13,7 +13,7 @@ data class MaintenanceActivity(
|
|||||||
val descricao: String,
|
val descricao: String,
|
||||||
val setor: String,
|
val setor: String,
|
||||||
val equipe: String,
|
val equipe: String,
|
||||||
val responsavel: String,
|
val recurso: String,
|
||||||
val dataInicio: String,
|
val dataInicio: String,
|
||||||
val dataFim: String,
|
val dataFim: String,
|
||||||
val percentualExecucao: Int, // 0 to 100
|
val percentualExecucao: Int, // 0 to 100
|
||||||
@@ -45,7 +45,7 @@ data class OSUpdateHistory(
|
|||||||
val percentualNovo: Int,
|
val percentualNovo: Int,
|
||||||
val observacao: String? = null,
|
val observacao: String? = null,
|
||||||
val fotoPath: String? = null,
|
val fotoPath: String? = null,
|
||||||
val responsavel: String
|
val recurso: String
|
||||||
)
|
)
|
||||||
|
|
||||||
fun extractDateOnly(dataStr: String): String {
|
fun extractDateOnly(dataStr: String): String {
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ class GoogleSheetsSyncService(private val context: Context) {
|
|||||||
val equipe = if (rawEquipe.isNotBlank()) sanitizeEquipe(rawEquipe) else "Mecânica"
|
val equipe = if (rawEquipe.isNotBlank()) sanitizeEquipe(rawEquipe) else "Mecânica"
|
||||||
|
|
||||||
val rawResp = if (resourceIdx != -1 && resourceIdx < row.size) row[resourceIdx].trim() else ""
|
val rawResp = if (resourceIdx != -1 && resourceIdx < row.size) row[resourceIdx].trim() else ""
|
||||||
val responsavel = if (rawResp.isNotBlank()) rawResp else "Sem Responsável"
|
val recurso = if (rawResp.isNotBlank()) rawResp else "Sem Recurso"
|
||||||
|
|
||||||
val dataInicio = if (inicioIdx != -1 && inicioIdx < row.size) row[inicioIdx].trim() else "N/A"
|
val dataInicio = if (inicioIdx != -1 && inicioIdx < row.size) row[inicioIdx].trim() else "N/A"
|
||||||
val dataFim = if (fimIdx != -1 && fimIdx < row.size) row[fimIdx].trim() else "N/A"
|
val dataFim = if (fimIdx != -1 && fimIdx < row.size) row[fimIdx].trim() else "N/A"
|
||||||
@@ -443,7 +443,7 @@ class GoogleSheetsSyncService(private val context: Context) {
|
|||||||
descricao = desc,
|
descricao = desc,
|
||||||
setor = setor,
|
setor = setor,
|
||||||
equipe = equipe,
|
equipe = equipe,
|
||||||
responsavel = responsavel,
|
recurso = recurso,
|
||||||
dataInicio = dataInicio,
|
dataInicio = dataInicio,
|
||||||
dataFim = dataFim,
|
dataFim = dataFim,
|
||||||
percentualExecucao = 0, // Determined later in repository by merging history logs
|
percentualExecucao = 0, // Determined later in repository by merging history logs
|
||||||
@@ -560,7 +560,7 @@ class GoogleSheetsSyncService(private val context: Context) {
|
|||||||
percentualNovo = new,
|
percentualNovo = new,
|
||||||
observacao = obs,
|
observacao = obs,
|
||||||
fotoPath = foto,
|
fotoPath = foto,
|
||||||
responsavel = resp
|
recurso = resp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -596,7 +596,7 @@ class GoogleSheetsSyncService(private val context: Context) {
|
|||||||
row[headerIndices["percentualnovo"] ?: 4] = history.percentualNovo.toString()
|
row[headerIndices["percentualnovo"] ?: 4] = history.percentualNovo.toString()
|
||||||
row[headerIndices["observacao"] ?: 5] = history.observacao ?: ""
|
row[headerIndices["observacao"] ?: 5] = history.observacao ?: ""
|
||||||
row[headerIndices["fotopath"] ?: 6] = history.fotoPath ?: ""
|
row[headerIndices["fotopath"] ?: 6] = history.fotoPath ?: ""
|
||||||
row[headerIndices["responsavel"] ?: 7] = history.responsavel
|
row[headerIndices["responsavel"] ?: 7] = history.recurso
|
||||||
row
|
row
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class MaintenanceRepository(
|
|||||||
novoPercentual: Int,
|
novoPercentual: Int,
|
||||||
observacao: String?,
|
observacao: String?,
|
||||||
fotoPath: String?,
|
fotoPath: String?,
|
||||||
responsavel: String
|
recurso: String
|
||||||
) = withContext(Dispatchers.IO) {
|
) = withContext(Dispatchers.IO) {
|
||||||
val currentActivity = dao.getActivityByOsOneShot(numeroOs) ?: return@withContext
|
val currentActivity = dao.getActivityByOsOneShot(numeroOs) ?: return@withContext
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class MaintenanceRepository(
|
|||||||
percentualNovo = novoPercentual,
|
percentualNovo = novoPercentual,
|
||||||
observacao = observacao,
|
observacao = observacao,
|
||||||
fotoPath = fotoPath,
|
fotoPath = fotoPath,
|
||||||
responsavel = responsavel
|
recurso = recurso
|
||||||
)
|
)
|
||||||
dao.insertHistory(historyEntry)
|
dao.insertHistory(historyEntry)
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ class MaintenanceRepository(
|
|||||||
val desc = rowCells[descIdx]
|
val desc = rowCells[descIdx]
|
||||||
val setor = if (setorIdx != -1 && setorIdx < rowCells.size) rowCells[setorIdx] else "Geral"
|
val setor = if (setorIdx != -1 && setorIdx < rowCells.size) rowCells[setorIdx] else "Geral"
|
||||||
val equipe = if (eqIdx != -1 && eqIdx < rowCells.size) rowCells[eqIdx] else "Mecânica"
|
val equipe = if (eqIdx != -1 && eqIdx < rowCells.size) rowCells[eqIdx] else "Mecânica"
|
||||||
val responsavel = if (respIdx != -1 && respIdx < rowCells.size) rowCells[respIdx] else "Sem Responsável"
|
val recurso = if (respIdx != -1 && respIdx < rowCells.size) rowCells[respIdx] else "Sem Recurso"
|
||||||
val dataInicio = if (inicioIdx != -1 && inicioIdx < rowCells.size) rowCells[inicioIdx] else "N/A"
|
val dataInicio = if (inicioIdx != -1 && inicioIdx < rowCells.size) rowCells[inicioIdx] else "N/A"
|
||||||
val dataFim = if (fimIdx != -1 && fimIdx < rowCells.size) rowCells[fimIdx] else "N/A"
|
val dataFim = if (fimIdx != -1 && fimIdx < rowCells.size) rowCells[fimIdx] else "N/A"
|
||||||
val pctStr = if (pctIdx != -1 && pctIdx < rowCells.size) rowCells[pctIdx].replace("%", "").trim() else "0"
|
val pctStr = if (pctIdx != -1 && pctIdx < rowCells.size) rowCells[pctIdx].replace("%", "").trim() else "0"
|
||||||
@@ -129,7 +129,7 @@ class MaintenanceRepository(
|
|||||||
descricao = desc,
|
descricao = desc,
|
||||||
setor = sanitizeSetor(setor),
|
setor = sanitizeSetor(setor),
|
||||||
equipe = sanitizeEquipe(equipe),
|
equipe = sanitizeEquipe(equipe),
|
||||||
responsavel = responsavel,
|
recurso = recurso,
|
||||||
dataInicio = dataInicio,
|
dataInicio = dataInicio,
|
||||||
dataFim = dataFim,
|
dataFim = dataFim,
|
||||||
percentualExecucao = pct.coerceIn(0, 100),
|
percentualExecucao = pct.coerceIn(0, 100),
|
||||||
@@ -177,7 +177,7 @@ class MaintenanceRepository(
|
|||||||
percentualAnterior = 0,
|
percentualAnterior = 0,
|
||||||
percentualNovo = activity.percentualExecucao,
|
percentualNovo = activity.percentualExecucao,
|
||||||
observacao = activity.observacoes,
|
observacao = activity.observacoes,
|
||||||
responsavel = activity.responsavel,
|
recurso = activity.recurso,
|
||||||
timestamp = now - 3600000 // 1 hour ago
|
timestamp = now - 3600000 // 1 hour ago
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ fun MaintenanceDashboardScreen(
|
|||||||
val selectedEquipe by viewModel.selectedEquipe.collectAsStateWithLifecycle()
|
val selectedEquipe by viewModel.selectedEquipe.collectAsStateWithLifecycle()
|
||||||
val selectedStatus by viewModel.selectedStatus.collectAsStateWithLifecycle()
|
val selectedStatus by viewModel.selectedStatus.collectAsStateWithLifecycle()
|
||||||
val selectedDataInicio by viewModel.selectedDataInicio.collectAsStateWithLifecycle()
|
val selectedDataInicio by viewModel.selectedDataInicio.collectAsStateWithLifecycle()
|
||||||
val selectedResponsavel by viewModel.selectedResponsavel.collectAsStateWithLifecycle()
|
val selectedRecurso by viewModel.selectedRecurso.collectAsStateWithLifecycle()
|
||||||
val searchQuery by viewModel.searchQuery.collectAsStateWithLifecycle()
|
val searchQuery by viewModel.searchQuery.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
val isSyncing by viewModel.isSyncing.collectAsStateWithLifecycle()
|
val isSyncing by viewModel.isSyncing.collectAsStateWithLifecycle()
|
||||||
@@ -101,9 +101,15 @@ fun MaintenanceDashboardScreen(
|
|||||||
listOf("Todas") + formattedDates
|
listOf("Todas") + formattedDates
|
||||||
}
|
}
|
||||||
|
|
||||||
val uniqueResponsibles = remember(allActivities) {
|
val uniqueRecursos = remember(allActivities) {
|
||||||
val resps = allActivities.map { it.responsavel }.filter { it.isNotBlank() && it != "Sem Responsável" && it != "Sem responsável" }.distinct().sorted()
|
val recs = allActivities.flatMap { activity ->
|
||||||
listOf("Todos") + resps
|
activity.recurso.split(";").map { it.trim() }
|
||||||
|
}.filter {
|
||||||
|
it.isNotBlank() &&
|
||||||
|
it != "Sem Responsável" && it != "Sem responsável" &&
|
||||||
|
it != "Sem Recurso" && it != "Sem recurso"
|
||||||
|
}.distinct().sorted()
|
||||||
|
listOf("Todos") + recs
|
||||||
}
|
}
|
||||||
|
|
||||||
val uniqueSectors = remember(allActivities) {
|
val uniqueSectors = remember(allActivities) {
|
||||||
@@ -269,15 +275,15 @@ fun MaintenanceDashboardScreen(
|
|||||||
selectedEquipe = selectedEquipe,
|
selectedEquipe = selectedEquipe,
|
||||||
selectedStatus = selectedStatus,
|
selectedStatus = selectedStatus,
|
||||||
selectedDataInicio = selectedDataInicio,
|
selectedDataInicio = selectedDataInicio,
|
||||||
selectedResponsavel = selectedResponsavel,
|
selectedRecurso = selectedRecurso,
|
||||||
uniqueSectors = uniqueSectors,
|
uniqueSectors = uniqueSectors,
|
||||||
uniqueDates = uniqueDates,
|
uniqueDates = uniqueDates,
|
||||||
uniqueResponsibles = uniqueResponsibles,
|
uniqueRecursos = uniqueRecursos,
|
||||||
onSetorSelected = { viewModel.setFilterSetor(it) },
|
onSetorSelected = { viewModel.setFilterSetor(it) },
|
||||||
onEquipeSelected = { viewModel.setFilterEquipe(it) },
|
onEquipeSelected = { viewModel.setFilterEquipe(it) },
|
||||||
onStatusSelected = { viewModel.setFilterStatus(it) },
|
onStatusSelected = { viewModel.setFilterStatus(it) },
|
||||||
onDataInicioSelected = { viewModel.setFilterDataInicio(it) },
|
onDataInicioSelected = { viewModel.setFilterDataInicio(it) },
|
||||||
onResponsavelSelected = { viewModel.setFilterResponsavel(it) }
|
onRecursoSelected = { viewModel.setFilterRecurso(it) }
|
||||||
)
|
)
|
||||||
|
|
||||||
// List Title and Item Count
|
// List Title and Item Count
|
||||||
@@ -357,7 +363,7 @@ fun MaintenanceDashboardScreen(
|
|||||||
viewModel.setFilterEquipe("Todas")
|
viewModel.setFilterEquipe("Todas")
|
||||||
viewModel.setFilterStatus("Todos")
|
viewModel.setFilterStatus("Todos")
|
||||||
viewModel.setFilterDataInicio("Todas")
|
viewModel.setFilterDataInicio("Todas")
|
||||||
viewModel.setFilterResponsavel("Todos")
|
viewModel.setFilterRecurso("Todos")
|
||||||
viewModel.setSearchQuery("")
|
viewModel.setSearchQuery("")
|
||||||
},
|
},
|
||||||
colors = ButtonDefaults.buttonColors(containerColor = CargillBlack)
|
colors = ButtonDefaults.buttonColors(containerColor = CargillBlack)
|
||||||
@@ -398,7 +404,7 @@ fun MaintenanceDashboardScreen(
|
|||||||
novoPercentual = newPct,
|
novoPercentual = newPct,
|
||||||
observacao = comment,
|
observacao = comment,
|
||||||
fotoPath = mockPhoto,
|
fotoPath = mockPhoto,
|
||||||
responsavel = "Encarregado Campo"
|
recurso = "Encarregado Campo"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -540,15 +546,15 @@ fun FilterPillsRow(
|
|||||||
selectedEquipe: String,
|
selectedEquipe: String,
|
||||||
selectedStatus: String,
|
selectedStatus: String,
|
||||||
selectedDataInicio: String,
|
selectedDataInicio: String,
|
||||||
selectedResponsavel: String,
|
selectedRecurso: String,
|
||||||
uniqueSectors: List<String>,
|
uniqueSectors: List<String>,
|
||||||
uniqueDates: List<String>,
|
uniqueDates: List<String>,
|
||||||
uniqueResponsibles: List<String>,
|
uniqueRecursos: List<String>,
|
||||||
onSetorSelected: (String) -> Unit,
|
onSetorSelected: (String) -> Unit,
|
||||||
onEquipeSelected: (String) -> Unit,
|
onEquipeSelected: (String) -> Unit,
|
||||||
onStatusSelected: (String) -> Unit,
|
onStatusSelected: (String) -> Unit,
|
||||||
onDataInicioSelected: (String) -> Unit,
|
onDataInicioSelected: (String) -> Unit,
|
||||||
onResponsavelSelected: (String) -> Unit
|
onRecursoSelected: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val setores = uniqueSectors
|
val setores = uniqueSectors
|
||||||
val equipes = listOf("Todas", "Mecânica", "Elétrica", "Confiabilidade", "Lubrificação")
|
val equipes = listOf("Todas", "Mecânica", "Elétrica", "Confiabilidade", "Lubrificação")
|
||||||
@@ -616,16 +622,16 @@ fun FilterPillsRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responsible Row
|
// Resource Row
|
||||||
Row(modifier = Modifier.padding(horizontal = 16.dp)) {
|
Row(modifier = Modifier.padding(horizontal = 16.dp)) {
|
||||||
Text("Resp.:", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = StatusGrey, modifier = Modifier.width(72.dp).align(Alignment.CenterVertically))
|
Text("Recurso:", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = StatusGrey, modifier = Modifier.width(72.dp).align(Alignment.CenterVertically))
|
||||||
LazyRow(
|
LazyRow(
|
||||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
items(uniqueResponsibles) { respVal ->
|
items(uniqueRecursos) { respVal ->
|
||||||
val isSelected = respVal == selectedResponsavel
|
val isSelected = respVal == selectedRecurso
|
||||||
FilterChipWidget(text = respVal, isSelected = isSelected, onClick = { onResponsavelSelected(respVal) })
|
FilterChipWidget(text = respVal, isSelected = isSelected, onClick = { onRecursoSelected(respVal) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,9 +802,9 @@ fun OSListItemCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responsible Supervisor Initials / Name
|
// Resource Names
|
||||||
Text(
|
Text(
|
||||||
text = "Resp: ${activity.responsavel}",
|
text = "Recurso: ${activity.recurso}",
|
||||||
fontSize = 11.sp,
|
fontSize = 11.sp,
|
||||||
color = StatusGrey,
|
color = StatusGrey,
|
||||||
fontWeight = FontWeight.Medium
|
fontWeight = FontWeight.Medium
|
||||||
@@ -945,7 +951,7 @@ fun EditActivityBottomSheet(
|
|||||||
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
Text("Setor: ${activity.setor}", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = CargillGreen)
|
Text("Setor: ${activity.setor}", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = CargillGreen)
|
||||||
Text("Equipe: ${activity.equipe}", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = StatusBlue)
|
Text("Equipe: ${activity.equipe}", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = StatusBlue)
|
||||||
Text("Resp: ${activity.responsavel}", fontSize = 11.sp, color = StatusGrey)
|
Text("Recurso: ${activity.recurso}", fontSize = 11.sp, color = StatusGrey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1202,7 @@ fun TimelineLogItem(log: OSUpdateHistory) {
|
|||||||
) {
|
) {
|
||||||
Icon(Icons.Default.Person, contentDescription = "Usuário", tint = StatusGrey, modifier = Modifier.size(12.dp))
|
Icon(Icons.Default.Person, contentDescription = "Usuário", tint = StatusGrey, modifier = Modifier.size(12.dp))
|
||||||
Text(
|
Text(
|
||||||
text = log.responsavel,
|
text = log.recurso,
|
||||||
fontSize = 11.sp,
|
fontSize = 11.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = CargillBlack
|
color = CargillBlack
|
||||||
@@ -1330,7 +1336,7 @@ fun ImporterConsoleSheet(
|
|||||||
) {
|
) {
|
||||||
Text("Estrutura Esperada do Arquivo (Excel):", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = CargillBlack)
|
Text("Estrutura Esperada do Arquivo (Excel):", fontSize = 11.sp, fontWeight = FontWeight.Bold, color = CargillBlack)
|
||||||
Text("• Colunas Obrigatórias: Número da OS, Descrição da Atividade", fontSize = 11.sp, color = StatusGrey)
|
Text("• Colunas Obrigatórias: Número da OS, Descrição da Atividade", fontSize = 11.sp, color = StatusGrey)
|
||||||
Text("• Colunas Opcionais: Setor, Equipe, Responsável, Início, Fim, %", fontSize = 11.sp, color = StatusGrey)
|
Text("• Colunas Opcionais: Setor, Equipe, Recurso, Início, Fim, %", fontSize = 11.sp, color = StatusGrey)
|
||||||
Text("• Suporta separadores por Vírgula (,) ou Ponto e Vírgula (;)", fontSize = 11.sp, color = StatusGrey)
|
Text("• Suporta separadores por Vírgula (,) ou Ponto e Vírgula (;)", fontSize = 11.sp, color = StatusGrey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
private val _selectedDataInicio = MutableStateFlow("Todas")
|
private val _selectedDataInicio = MutableStateFlow("Todas")
|
||||||
val selectedDataInicio = _selectedDataInicio.asStateFlow()
|
val selectedDataInicio = _selectedDataInicio.asStateFlow()
|
||||||
|
|
||||||
private val _selectedResponsavel = MutableStateFlow("Todos")
|
private val _selectedRecurso = MutableStateFlow("Todos")
|
||||||
val selectedResponsavel = _selectedResponsavel.asStateFlow()
|
val selectedRecurso = _selectedRecurso.asStateFlow()
|
||||||
|
|
||||||
private val _searchQuery = MutableStateFlow("")
|
private val _searchQuery = MutableStateFlow("")
|
||||||
val searchQuery = _searchQuery.asStateFlow()
|
val searchQuery = _searchQuery.asStateFlow()
|
||||||
@@ -78,7 +78,7 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
_selectedEquipe,
|
_selectedEquipe,
|
||||||
_selectedStatus,
|
_selectedStatus,
|
||||||
_selectedDataInicio,
|
_selectedDataInicio,
|
||||||
_selectedResponsavel,
|
_selectedRecurso,
|
||||||
_searchQuery
|
_searchQuery
|
||||||
) { flowsArray ->
|
) { flowsArray ->
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -87,7 +87,7 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
val equipe = flowsArray[2] as String
|
val equipe = flowsArray[2] as String
|
||||||
val status = flowsArray[3] as String
|
val status = flowsArray[3] as String
|
||||||
val dataInicio = flowsArray[4] as String
|
val dataInicio = flowsArray[4] as String
|
||||||
val responsavel = flowsArray[5] as String
|
val recurso = flowsArray[5] as String
|
||||||
val query = flowsArray[6] as String
|
val query = flowsArray[6] as String
|
||||||
|
|
||||||
val filtered = activities.filter { activity ->
|
val filtered = activities.filter { activity ->
|
||||||
@@ -100,13 +100,13 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
val matchDataInicio = dataInicio == "Todas" || formatToShortDate(activity.dataInicio) == dataInicio
|
val matchDataInicio = dataInicio == "Todas" || formatToShortDate(activity.dataInicio) == dataInicio
|
||||||
val matchResponsavel = responsavel == "Todos" || activity.responsavel == responsavel
|
val matchRecurso = recurso == "Todos" || activity.recurso.split(";").map { it.trim() }.contains(recurso)
|
||||||
val matchQuery = query.isBlank() ||
|
val matchQuery = query.isBlank() ||
|
||||||
activity.numeroOs.contains(query, ignoreCase = true) ||
|
activity.numeroOs.contains(query, ignoreCase = true) ||
|
||||||
activity.descricao.contains(query, ignoreCase = true) ||
|
activity.descricao.contains(query, ignoreCase = true) ||
|
||||||
activity.responsavel.contains(query, ignoreCase = true)
|
activity.recurso.contains(query, ignoreCase = true)
|
||||||
|
|
||||||
matchSetor && matchEquipe && matchStatus && matchDataInicio && matchResponsavel && matchQuery
|
matchSetor && matchEquipe && matchStatus && matchDataInicio && matchRecurso && matchQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataInicio != "Todas") {
|
if (dataInicio != "Todas") {
|
||||||
@@ -188,8 +188,8 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
_selectedDataInicio.value = dataInicio
|
_selectedDataInicio.value = dataInicio
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setFilterResponsavel(responsavel: String) {
|
fun setFilterRecurso(recurso: String) {
|
||||||
_selectedResponsavel.value = responsavel
|
_selectedRecurso.value = recurso
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSearchQuery(query: String) {
|
fun setSearchQuery(query: String) {
|
||||||
@@ -271,10 +271,10 @@ class MaintenanceViewModel(private val repository: MaintenanceRepository) : View
|
|||||||
novoPercentual: Int,
|
novoPercentual: Int,
|
||||||
observacao: String?,
|
observacao: String?,
|
||||||
fotoPath: String?,
|
fotoPath: String?,
|
||||||
responsavel: String
|
recurso: String
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
repository.updateProgress(numeroOs, novoPercentual, observacao, fotoPath, responsavel)
|
repository.updateProgress(numeroOs, novoPercentual, observacao, fotoPath, recurso)
|
||||||
// Update selected activity model in state to refresh UI
|
// Update selected activity model in state to refresh UI
|
||||||
_selectedActivity.value?.let { active ->
|
_selectedActivity.value?.let { active ->
|
||||||
if (active.numeroOs == numeroOs) {
|
if (active.numeroOs == numeroOs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user