use of de.symeda.sormas.app.util.Bundler in project SORMAS-Project by hzi-braunschweig.
the class CaseNewFragment method onAfterLayoutBinding.
@Override
public void onAfterLayoutBinding(final FragmentCaseNewLayoutBinding contentBinding) {
InfrastructureDaoHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.caseDataHealthFacility, contentBinding.caseDataHealthFacilityDetails);
InfrastructureDaoHelper.initializePointOfEntryDetailsFieldVisibility(contentBinding.caseDataPointOfEntry, contentBinding.caseDataPointOfEntryDetails);
if (!ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_GERMANY) && !ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_SWITZERLAND)) {
contentBinding.caseDataExternalID.setVisibility(GONE);
contentBinding.caseDataExternalToken.setVisibility(GONE);
} else {
contentBinding.caseDataEpidNumber.setVisibility(GONE);
}
contentBinding.caseDataResponsibleRegion.setEnabled(false);
contentBinding.caseDataResponsibleRegion.setRequired(false);
contentBinding.caseDataResponsibleDistrict.setEnabled(false);
contentBinding.caseDataResponsibleDistrict.setRequired(false);
User user = ConfigProvider.getUser();
if (user.getPointOfEntry() == null) {
contentBinding.facilityOrHome.setValue(TypeOfPlace.FACILITY);
}
if (user.hasUserRole(UserRole.HOSPITAL_INFORMANT) && user.getHealthFacility() != null) {
// Hospital Informants are not allowed to create cases in another health facility
contentBinding.caseDataCommunity.setEnabled(false);
contentBinding.caseDataCommunity.setRequired(false);
contentBinding.caseDataHealthFacility.setEnabled(false);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.facilityOrHome.setEnabled(false);
contentBinding.facilityTypeGroup.setEnabled(false);
contentBinding.caseDataFacilityType.setEnabled(false);
contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setEnabled(false);
contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setVisibility(GONE);
}
if (user.hasUserRole(UserRole.POE_INFORMANT) && user.getPointOfEntry() != null) {
contentBinding.caseDataPointOfEntry.setEnabled(false);
contentBinding.caseDataPointOfEntry.setRequired(false);
}
if (user.hasUserRole(UserRole.COMMUNITY_INFORMANT) && user.getCommunity() != null) {
// Community Informants are not allowed to create cases in another community
contentBinding.caseDataCommunity.setEnabled(false);
contentBinding.caseDataCommunity.setRequired(false);
}
// Disable personal details and disease fields when case is created from contact
// or event person
Bundler bundler = new Bundler(getArguments());
if (bundler.getContactUuid() != null || bundler.getEventParticipantUuid() != null) {
contentBinding.caseDataFirstName.setEnabled(false);
contentBinding.caseDataLastName.setEnabled(false);
contentBinding.personSex.setEnabled(false);
contentBinding.personBirthdateYYYY.setEnabled(false);
contentBinding.personBirthdateMM.setEnabled(false);
contentBinding.personBirthdateDD.setEnabled(false);
contentBinding.caseDataDisease.setEnabled(false);
contentBinding.caseDataDiseaseDetails.setEnabled(false);
contentBinding.caseDataPlagueType.setEnabled(false);
contentBinding.caseDataDengueFeverType.setEnabled(false);
contentBinding.caseDataHumanRabiesType.setEnabled(false);
}
// Set up port health visibilities
if (UserRole.isPortHealthUser(ConfigProvider.getUser().getUserRoles())) {
contentBinding.caseDataCaseOrigin.setVisibility(GONE);
contentBinding.caseDataDisease.setVisibility(GONE);
contentBinding.facilityOrHome.setVisibility(GONE);
contentBinding.caseDataCommunity.setVisibility(GONE);
contentBinding.facilityTypeFieldsLayout.setVisibility(GONE);
contentBinding.caseDataHealthFacility.setVisibility(GONE);
contentBinding.facilityTypeGroup.setRequired(false);
contentBinding.caseDataFacilityType.setRequired(false);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.caseDataHealthFacilityDetails.setRequired(false);
} else if (DatabaseHelper.getPointOfEntryDao().hasActiveEntriesInDistrict()) {
if (record.getCaseOrigin() == CaseOrigin.IN_COUNTRY) {
contentBinding.caseDataPointOfEntry.setRequired(false);
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
} else {
contentBinding.caseDataHealthFacility.setRequired(false);
}
contentBinding.caseDataCaseOrigin.addValueChangedListener(e -> {
if (e.getValue() == CaseOrigin.IN_COUNTRY) {
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
contentBinding.caseDataPointOfEntry.setRequired(false);
contentBinding.caseDataPointOfEntry.setValue(null);
contentBinding.caseDataHealthFacility.setRequired(true);
} else {
contentBinding.caseDataPointOfEntry.setVisibility(VISIBLE);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.caseDataPointOfEntry.setRequired(true);
}
});
} else {
contentBinding.caseDataCaseOrigin.setVisibility(GONE);
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
}
}
use of de.symeda.sormas.app.util.Bundler in project SORMAS-Project by hzi-braunschweig.
the class ClinicalVisitEditActivity method onSaveInstanceState.
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
new Bundler(outState).setCaseUuid(caseUuid);
}
use of de.symeda.sormas.app.util.Bundler in project SORMAS-Project by hzi-braunschweig.
the class ClinicalVisitReadActivity method onSaveInstanceState.
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
new Bundler(outState).setCaseUuid(caseUuid);
}
use of de.symeda.sormas.app.util.Bundler in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationNewFragment method onAfterLayoutBinding.
@Override
protected void onAfterLayoutBinding(FragmentImmunizationNewLayoutBinding contentBinding) {
InfrastructureDaoHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.immunizationHealthFacility, contentBinding.immunizationHealthFacilityDetails);
contentBinding.immunizationMeansOfImmunization.addValueChangedListener(e -> {
if (!Boolean.TRUE.equals(contentBinding.overwriteImmunizationManagementStatusCheckBox.getValue())) {
if (e.getValue() == MeansOfImmunization.OTHER || e.getValue() == MeansOfImmunization.RECOVERY) {
contentBinding.immunizationImmunizationManagementStatus.setValue(ImmunizationManagementStatus.COMPLETED);
} else {
contentBinding.immunizationImmunizationManagementStatus.setValue(ImmunizationManagementStatus.SCHEDULED);
}
}
boolean isVaccination = MeansOfImmunization.isVaccination((MeansOfImmunization) e.getValue());
contentBinding.immunizationNumberOfDoses.setVisibility(isVaccination ? View.VISIBLE : View.GONE);
contentBinding.immunizationNumberOfDoses.setEnabled(isVaccination);
});
contentBinding.overwriteImmunizationManagementStatusCheckBox.addValueChangedListener(e -> contentBinding.immunizationImmunizationManagementStatus.setEnabled(Boolean.TRUE.equals(e.getValue())));
contentBinding.immunizationImmunizationManagementStatus.addValueChangedListener(e -> {
if (e.getValue() == ImmunizationManagementStatus.SCHEDULED || e.getValue() == ImmunizationManagementStatus.ONGOING) {
contentBinding.immunizationImmunizationStatus.setValue(ImmunizationStatus.PENDING);
}
if (e.getValue() == ImmunizationManagementStatus.COMPLETED) {
contentBinding.immunizationImmunizationStatus.setValue(ImmunizationStatus.ACQUIRED);
}
if (e.getValue() == ImmunizationManagementStatus.CANCELED) {
contentBinding.immunizationImmunizationStatus.setValue(ImmunizationStatus.NOT_ACQUIRED);
}
});
contentBinding.immunizationImmunizationManagementStatus.setValue(ImmunizationManagementStatus.SCHEDULED);
contentBinding.immunizationImmunizationManagementStatus.setEnabled(false);
contentBinding.immunizationNumberOfDoses.setVisibility(View.GONE);
if (!(record.getHealthFacility() == null || (record.getHealthFacility() != null && FacilityDto.NONE_FACILITY_UUID.equals(record.getHealthFacility().getUuid())))) {
final FacilityType facilityType = record.getFacilityType();
if (facilityType != null) {
contentBinding.facilityTypeGroup.setValue(facilityType.getFacilityTypeGroup());
}
}
// Disable personal details fields when immunization is created from case, contact or event participant
Bundler bundler = new Bundler(getArguments());
if (bundler.getCaseUuid() != null || bundler.getContactUuid() != null || bundler.getEventParticipantUuid() != null) {
contentBinding.personFirstName.setEnabled(false);
contentBinding.personLastName.setEnabled(false);
contentBinding.personSex.setEnabled(false);
contentBinding.personBirthdateYYYY.setEnabled(false);
contentBinding.personBirthdateMM.setEnabled(false);
contentBinding.personBirthdateDD.setEnabled(false);
}
}
use of de.symeda.sormas.app.util.Bundler in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationNewFragment method onLayoutBinding.
@Override
protected void onLayoutBinding(FragmentImmunizationNewLayoutBinding contentBinding) {
contentBinding.setData(record);
contentBinding.setYesNoUnknownClass(YesNoUnknown.class);
InfrastructureFieldsDependencyHandler.instance.initializeFacilityFields(record, contentBinding.immunizationResponsibleRegion, initialResponsibleRegions, record.getResponsibleRegion(), contentBinding.immunizationResponsibleDistrict, initialResponsibleDistricts, record.getResponsibleDistrict(), contentBinding.immunizationResponsibleCommunity, initialResponsibleCommunities, record.getResponsibleCommunity(), null, null, contentBinding.facilityTypeGroup, facilityTypeGroupList, contentBinding.immunizationFacilityType, facilityTypeList, contentBinding.immunizationHealthFacility, initialFacilities, record.getHealthFacility(), contentBinding.immunizationHealthFacilityDetails, true);
// Initialize ControlSpinnerFields
contentBinding.immunizationDisease.initializeSpinner(diseaseList);
contentBinding.immunizationImmunizationStatus.initializeSpinner(immunizationStatusList);
contentBinding.immunizationImmunizationStatus.setEnabled(false);
contentBinding.immunizationImmunizationManagementStatus.initializeSpinner(immunizationManagementStatusList);
contentBinding.immunizationMeansOfImmunization.initializeSpinner(meansOfImmunizationList);
contentBinding.personBirthdateDD.initializeSpinner(new ArrayList<>());
contentBinding.personBirthdateMM.initializeSpinner(monthList, field -> DataUtils.updateListOfDays(contentBinding.personBirthdateDD, (Integer) contentBinding.personBirthdateYYYY.getValue(), (Integer) field.getValue()));
contentBinding.personBirthdateYYYY.initializeSpinner(yearList, field -> DataUtils.updateListOfDays(contentBinding.personBirthdateDD, (Integer) field.getValue(), (Integer) contentBinding.personBirthdateMM.getValue()));
int year = Calendar.getInstance().get(Calendar.YEAR);
contentBinding.personBirthdateYYYY.setSelectionOnOpen(year - 35);
contentBinding.personSex.initializeSpinner(sexList);
if (record.getDisease() != null && new Bundler(getArguments()).getEventParticipantUuid() != null) {
contentBinding.immunizationDisease.setEnabled(false);
}
// Initialize ControlDateFields
contentBinding.immunizationReportDate.initializeDateField(getFragmentManager());
contentBinding.immunizationStartDate.initializeDateField(getFragmentManager());
contentBinding.immunizationEndDate.initializeDateField(getFragmentManager());
ValidationHelper.initDateIntervalValidator(contentBinding.immunizationStartDate, contentBinding.immunizationEndDate);
contentBinding.immunizationValidFrom.initializeDateField(getFragmentManager());
contentBinding.immunizationValidUntil.initializeDateField(getFragmentManager());
ValidationHelper.initDateIntervalValidator(contentBinding.immunizationValidFrom, contentBinding.immunizationValidUntil);
ValidationHelper.initIntegerValidator(contentBinding.immunizationNumberOfDoses, I18nProperties.getValidationError(Validations.vaccineDosesFormat), 1, 10);
}
Aggregations