Search in sources :

Example 1 with ClinicalCourseForm

use of de.symeda.sormas.ui.clinicalcourse.ClinicalCourseForm in project SORMAS-Project by hzi-braunschweig.

the class CaseController method getClinicalCourseComponent.

public CommitDiscardWrapperComponent<ClinicalCourseForm> getClinicalCourseComponent(String caseUuid) {
    CaseDataDto caze = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
    ClinicalCourseForm form = new ClinicalCourseForm(caze.isPseudonymized());
    form.setValue(caze.getClinicalCourse());
    final CommitDiscardWrapperComponent<ClinicalCourseForm> view = new CommitDiscardWrapperComponent<>(form, UserProvider.getCurrent().hasUserRight(UserRight.CLINICAL_COURSE_EDIT), form.getFieldGroup());
    view.addCommitListener(() -> {
        if (!form.getFieldGroup().isModified()) {
            CaseDataDto cazeDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
            cazeDto.setClinicalCourse(form.getValue());
            saveCase(cazeDto);
        }
    });
    view.getCommitButton().setVisible(false);
    view.getDiscardButton().setVisible(false);
    return view;
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) ClinicalCourseForm(de.symeda.sormas.ui.clinicalcourse.ClinicalCourseForm) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)

Aggregations

CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 ClinicalCourseForm (de.symeda.sormas.ui.clinicalcourse.ClinicalCourseForm)1 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)1