Skip to content

Commit

Permalink
search scope must return search and capture org units
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan authored and andresmr committed Apr 26, 2024
1 parent 74f69ea commit 70e3b29
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ class EventDetailsFragment : FragmentGlobalAbstract() {
detailsEnabled = details.enabled,
onDateClick = {},
onDateSelected = { dateValues ->
viewModel.onDateSet(dateValues.year, dateValues.month - 1, dateValues.day)
viewModel.onDateSet(
dateValues.year,
dateValues.month - 1,
dateValues.day,
)
},
onClear = { viewModel.onClearEventReportDate() },
required = true,
Expand Down Expand Up @@ -298,7 +302,10 @@ class EventDetailsFragment : FragmentGlobalAbstract() {
)
}
} else if (!catCombo.isDefault) {
ProvideEmptyCategorySelector(name = catCombo.displayName ?: getString(R.string.cat_combo), option = getString(R.string.no_options))
ProvideEmptyCategorySelector(
name = catCombo.displayName ?: getString(R.string.cat_combo),
option = getString(R.string.no_options),
)
}
ProvideCoordinates(
coordinates = coordinates,
Expand Down Expand Up @@ -339,7 +346,20 @@ class EventDetailsFragment : FragmentGlobalAbstract() {
)
.singleSelection()
.orgUnitScope(
OrgUnitSelectorScope.ProgramCaptureScope(viewModel.eventOrgUnit.value.programUid!!),
when (getEventCreationType(requireArguments().getString(EVENT_CREATION_TYPE))) {
EventCreationType.REFERAL ->
OrgUnitSelectorScope.ProgramSearchScope(
viewModel.eventOrgUnit.value.programUid!!,
)

EventCreationType.DEFAULT,
EventCreationType.ADDNEW,
EventCreationType.SCHEDULE,
->
OrgUnitSelectorScope.ProgramCaptureScope(
viewModel.eventOrgUnit.value.programUid!!,
)
},
)
.onSelection { selectedOrgUnits ->
viewModel.setUpOrgUnit(selectedOrgUnit = selectedOrgUnits.firstOrNull()?.uid())
Expand Down

0 comments on commit 70e3b29

Please sign in to comment.