use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.
the class ClinicalVisitForm method addFields.
@Override
protected void addFields() {
if (disease == null) {
// workaround to stop initialization until disease is set
return;
}
addField(ClinicalVisitDto.VISIT_DATE_TIME, DateTimeField.class);
addField(ClinicalVisitDto.VISITING_PERSON, TextField.class);
addField(ClinicalVisitDto.VISIT_REMARKS, TextField.class).setDescription(I18nProperties.getPrefixDescription(ClinicalVisitDto.I18N_PREFIX, ClinicalVisitDto.VISIT_REMARKS, "") + "\n" + I18nProperties.getDescription(Descriptions.descGdpr));
;
symptomsForm = new SymptomsForm(null, disease, person, SymptomsContext.CLINICAL_VISIT, null, fieldAccessCheckers);
getFieldGroup().bind(symptomsForm, ClinicalVisitDto.SYMPTOMS);
getContent().addComponent(symptomsForm, ClinicalVisitDto.SYMPTOMS);
setRequired(true, ClinicalVisitDto.VISIT_DATE_TIME);
initializeAccessAndAllowedAccesses();
}
use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.
the class CaseController method getSymptomsEditComponent.
public CommitDiscardWrapperComponent<SymptomsForm> getSymptomsEditComponent(final String caseUuid, ViewMode viewMode) {
CaseDataDto caseDataDto = findCase(caseUuid);
PersonDto person = FacadeProvider.getPersonFacade().getPersonByUuid(caseDataDto.getPerson().getUuid());
SymptomsForm symptomsForm = new SymptomsForm(caseDataDto, caseDataDto.getDisease(), person, SymptomsContext.CASE, viewMode, UiFieldAccessCheckers.forSensitiveData(caseDataDto.isPseudonymized()));
symptomsForm.setValue(caseDataDto.getSymptoms());
CommitDiscardWrapperComponent<SymptomsForm> editView = new CommitDiscardWrapperComponent<SymptomsForm>(symptomsForm, UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT), symptomsForm.getFieldGroup());
editView.addCommitListener(() -> {
CaseDataDto cazeDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
cazeDto.setSymptoms(symptomsForm.getValue());
saveCase(cazeDto);
});
return editView;
}
use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.
the class VisitEditForm method addFields.
@Override
protected void addFields() {
if (disease == null) {
// workaround to stop initialization until disease is set
return;
}
VerticalLayout layoutPhoneLink = new VerticalLayout();
layoutPhoneLink.setSpacing(false);
layoutPhoneLink.setMargin(false);
layoutPhoneLink.setWidth(100, Unit.PERCENTAGE);
Label labelPhoneLink = new Label((I18nProperties.getCaption(Captions.contactPersonPhoneNumber)));
labelPhoneLink.setPrimaryStyleName("v-caption");
layoutPhoneLink.addComponent(labelPhoneLink);
Link linkPhone = new Link(this.person.getPhone(), new ExternalResource(PHONE_LINK_PREFIX + this.person.getPhone()));
linkPhone.setWidth(100, Unit.PERCENTAGE);
layoutPhoneLink.addComponent(linkPhone);
getContent().addComponent(layoutPhoneLink, CONTACT_PERSON_PHONE_NUMBER_LOC);
addField(VisitDto.VISIT_DATE_TIME, DateTimeField.class);
NullableOptionGroup visitStatus = addField(VisitDto.VISIT_STATUS, NullableOptionGroup.class);
addField(VisitDto.VISIT_REMARKS, TextField.class).setDescription(I18nProperties.getPrefixDescription(VisitDto.I18N_PREFIX, VisitDto.VISIT_REMARKS) + "\n" + I18nProperties.getDescription(Descriptions.descGdpr));
symptomsForm = new SymptomsForm(null, disease, person, SymptomsContext.VISIT, null, fieldAccessCheckers);
getFieldGroup().bind(symptomsForm, VisitDto.SYMPTOMS);
getContent().addComponent(symptomsForm, VisitDto.SYMPTOMS);
setRequired(true, VisitDto.VISIT_DATE_TIME, VisitDto.VISIT_STATUS);
initializeAccessAndAllowedAccesses();
if (contact != null) {
Date startDate = ContactLogic.getStartDate(contact);
addDateValidation(startDate, startDate, contact.getLastContactDate() != null ? Validations.visitBeforeLastContactDate : Validations.visitBeforeContactReport, contact.getFollowUpUntil());
}
if (caze != null) {
addDateValidation(CaseLogic.getStartDate(caze), caze.getReportDate(), caze.getSymptoms().getOnsetDate() != null ? Validations.visitBeforeSymptomsOnSet : Validations.visitBeforeCaseReport, CaseLogic.getEndDate(caze.getSymptoms().getOnsetDate(), caze.getReportDate(), caze.getFollowUpUntil()));
}
symptomsForm.initializeSymptomRequirementsForVisit((NullableOptionGroup) getFieldGroup().getField(VisitDto.VISIT_STATUS));
FieldHelper.setEnabledWhen(getFieldGroup(), visitStatus, Arrays.asList(VisitStatus.COOPERATIVE), Arrays.asList(VisitDto.SYMPTOMS), true);
}
Aggregations