Search in sources :

Example 1 with EpiDataForm

use of de.symeda.sormas.ui.epidata.EpiDataForm in project SORMAS-Project by hzi-braunschweig.

the class ContactController method getEpiDataComponent.

public CommitDiscardWrapperComponent<EpiDataForm> getEpiDataComponent(final String contactUuid) {
    ContactDto contact = FacadeProvider.getContactFacade().getByUuid(contactUuid);
    EpiDataForm epiDataForm = new EpiDataForm(contact.getDisease(), ContactDto.class, contact.getEpiData().isPseudonymized(), null);
    epiDataForm.setValue(contact.getEpiData());
    final CommitDiscardWrapperComponent<EpiDataForm> editView = new CommitDiscardWrapperComponent<EpiDataForm>(epiDataForm, UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EDIT), epiDataForm.getFieldGroup());
    editView.addCommitListener(() -> {
        ContactDto contactDto = FacadeProvider.getContactFacade().getByUuid(contactUuid);
        contactDto.setEpiData(epiDataForm.getValue());
        FacadeProvider.getContactFacade().save(contactDto);
        Notification.show(I18nProperties.getString(Strings.messageContactSaved), Type.WARNING_MESSAGE);
        SormasUI.refreshView();
    });
    return editView;
}
Also used : EpiDataForm(de.symeda.sormas.ui.epidata.EpiDataForm) ContactDto(de.symeda.sormas.api.contact.ContactDto) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)

Example 2 with EpiDataForm

use of de.symeda.sormas.ui.epidata.EpiDataForm in project SORMAS-Project by hzi-braunschweig.

the class CaseController method getEpiDataComponent.

public CommitDiscardWrapperComponent<EpiDataForm> getEpiDataComponent(final String caseUuid, Consumer<Boolean> sourceContactsToggleCallback) {
    CaseDataDto caze = findCase(caseUuid);
    EpiDataForm epiDataForm = new EpiDataForm(caze.getDisease(), CaseDataDto.class, caze.isPseudonymized(), sourceContactsToggleCallback);
    epiDataForm.setValue(caze.getEpiData());
    final CommitDiscardWrapperComponent<EpiDataForm> editView = new CommitDiscardWrapperComponent<EpiDataForm>(epiDataForm, UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT), epiDataForm.getFieldGroup());
    editView.addCommitListener(() -> {
        CaseDataDto cazeDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
        cazeDto.setEpiData(epiDataForm.getValue());
        saveCase(cazeDto);
    });
    return editView;
}
Also used : EpiDataForm(de.symeda.sormas.ui.epidata.EpiDataForm) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)

Aggregations

EpiDataForm (de.symeda.sormas.ui.epidata.EpiDataForm)2 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)2 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 ContactDto (de.symeda.sormas.api.contact.ContactDto)1 SimilarContactDto (de.symeda.sormas.api.contact.SimilarContactDto)1