Search in sources :

Example 1 with PersonEditForm

use of de.symeda.sormas.ui.person.PersonEditForm in project SORMAS-Project by hzi-braunschweig.

the class CasePersonView method initView.

@Override
protected void initView(String params) {
    CaseDataDto caseData = FacadeProvider.getCaseFacade().getCaseDataByUuid(getCaseRef().getUuid());
    CommitDiscardWrapperComponent<PersonEditForm> personEditComponent = ControllerProvider.getPersonController().getPersonEditComponent(PersonContext.CASE, caseData.getPerson().getUuid(), caseData.getDisease(), caseData.getDiseaseDetails(), UserRight.CASE_EDIT, getViewMode());
    setSubComponent(personEditComponent);
    setCaseEditPermission(personEditComponent);
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) PersonEditForm(de.symeda.sormas.ui.person.PersonEditForm)

Example 2 with PersonEditForm

use of de.symeda.sormas.ui.person.PersonEditForm in project SORMAS-Project by hzi-braunschweig.

the class RelatedLabMessageHandler method handlePersonCorrection.

@Override
protected void handlePersonCorrection(LabMessageDto labMessage, PersonDto person, PersonDto updatedPerson, List<String[]> changedFields, RelatedLabMessageHandlerChain chain) {
    CorrectionPanel<PersonDto> personCorrectionPanel = new CorrectionPanel<>(() -> new PersonEditForm(person.isPseudonymized()), person, updatedPerson, Strings.headingPreviousPersonInformation, Strings.headingUpdatedPersonInformation, changedFields);
    showCorrectionWindow(labMessage, Strings.headingCorrectPerson, personCorrectionPanel, p -> {
        FacadeProvider.getPersonFacade().savePerson(p);
        Notification.show(I18nProperties.getString(Strings.messagePersonSaved), Notification.Type.TRAY_NOTIFICATION);
    }, chain);
}
Also used : PersonDto(de.symeda.sormas.api.person.PersonDto) PersonEditForm(de.symeda.sormas.ui.person.PersonEditForm)

Example 3 with PersonEditForm

use of de.symeda.sormas.ui.person.PersonEditForm in project SORMAS-Project by hzi-braunschweig.

the class EventParticipantEditForm method setPerson.

@Override
public void setPerson(PersonDto person) {
    if (person != null) {
        this.getValue().setPerson(person);
    } else {
        this.getValue().setPerson(originalPerson);
    }
    getFieldGroup().unbind(pef);
    pef = new PersonEditForm(PersonContext.EVENT_PARTICIPANT, event.getDisease(), event.getDiseaseDetails(), null, person != null ? person.isPseudonymized() : isPersonPseudonymized);
    pef.setWidth(100, Unit.PERCENTAGE);
    pef.setImmediate(true);
    getFieldGroup().bind(pef, EventParticipantDto.PERSON);
    getContent().addComponent(pef, EventParticipantDto.PERSON);
}
Also used : PersonEditForm(de.symeda.sormas.ui.person.PersonEditForm)

Example 4 with PersonEditForm

use of de.symeda.sormas.ui.person.PersonEditForm in project SORMAS-Project by hzi-braunschweig.

the class EventParticipantEditForm method addFields.

@Override
protected void addFields() {
    if (event == null) {
        // workaround to stop initialization until event is set
        return;
    }
    if (searchPerson) {
        searchPersonButton = createPersonSearchButton(PERSON_SEARCH_LOC);
        searchPersonButton.setCaption(I18nProperties.getString(Strings.infoSearchPersonOnDependentForm));
        getContent().addComponent(searchPersonButton, PERSON_SEARCH_LOC);
    }
    pef = new PersonEditForm(PersonContext.EVENT_PARTICIPANT, event.getDisease(), event.getDiseaseDetails(), null, isPersonPseudonymized);
    pef.setWidth(100, Unit.PERCENTAGE);
    pef.setImmediate(true);
    getFieldGroup().bind(pef, EventParticipantDto.PERSON);
    getContent().addComponent(pef, EventParticipantDto.PERSON);
    addField(EventParticipantDto.INVOLVEMENT_DESCRIPTION, TextField.class);
    ComboBox region = addInfrastructureField(EventParticipantDto.REGION);
    region.setDescription(I18nProperties.getPrefixDescription(EventParticipantDto.I18N_PREFIX, EventParticipantDto.REGION));
    ComboBox district = addInfrastructureField(EventParticipantDto.DISTRICT);
    district.setDescription(I18nProperties.getPrefixDescription(EventParticipantDto.I18N_PREFIX, EventParticipantDto.DISTRICT));
    region.addValueChangeListener(e -> {
        RegionReferenceDto regionDto = (RegionReferenceDto) e.getProperty().getValue();
        FieldHelper.updateItems(district, regionDto != null ? FacadeProvider.getDistrictFacade().getAllActiveByRegion(regionDto.getUuid()) : null);
    });
    region.addItems(FacadeProvider.getRegionFacade().getAllActiveByServerCountry());
    LocationDto locationDto = event.getEventLocation();
    boolean shouldBeRequired = locationDto.getRegion() == null || locationDto.getDistrict() == null;
    region.setRequired(shouldBeRequired);
    district.setRequired(shouldBeRequired);
    addField(EventParticipantDto.REPORTING_USER, ComboBox.class);
    setReadOnly(true, EventParticipantDto.REPORTING_USER);
    initializeVisibilitiesAndAllowedVisibilities();
    initializeAccessAndAllowedAccesses();
    addField(EventParticipantDto.VACCINATION_STATUS);
    addField(EventParticipantDto.DELETION_REASON);
    addField(EventParticipantDto.OTHER_DELETION_REASON, TextArea.class).setRows(3);
    setVisible(false, EventParticipantDto.DELETION_REASON, EventParticipantDto.OTHER_DELETION_REASON);
}
Also used : RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) TextArea(com.vaadin.v7.ui.TextArea) ComboBox(com.vaadin.v7.ui.ComboBox) PersonEditForm(de.symeda.sormas.ui.person.PersonEditForm) LocationDto(de.symeda.sormas.api.location.LocationDto)

Example 5 with PersonEditForm

use of de.symeda.sormas.ui.person.PersonEditForm in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryPersonView method initView.

@Override
protected void initView(String params) {
    TravelEntryDto dto = FacadeProvider.getTravelEntryFacade().getByUuid(getReference().getUuid());
    CommitDiscardWrapperComponent<PersonEditForm> travelEntryPersonComponent = ControllerProvider.getPersonController().getPersonEditComponent(PersonContext.TRAVEL_ENTRY, dto.getPerson().getUuid(), dto.getDisease(), dto.getDiseaseDetails(), UserRight.TRAVEL_ENTRY_EDIT, null);
    setSubComponent(travelEntryPersonComponent);
    setTravelEntryEditPermission(travelEntryPersonComponent);
}
Also used : TravelEntryDto(de.symeda.sormas.api.travelentry.TravelEntryDto) PersonEditForm(de.symeda.sormas.ui.person.PersonEditForm)

Aggregations

PersonEditForm (de.symeda.sormas.ui.person.PersonEditForm)9 PersonDto (de.symeda.sormas.api.person.PersonDto)3 TextArea (com.vaadin.v7.ui.TextArea)2 LocationDto (de.symeda.sormas.api.location.LocationDto)2 Notifier (com.vaadin.event.Action.Notifier)1 KeyCode (com.vaadin.event.ShortcutAction.KeyCode)1 Page (com.vaadin.server.Page)1 Alignment (com.vaadin.ui.Alignment)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 Component (com.vaadin.ui.Component)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Notification (com.vaadin.ui.Notification)1 Type (com.vaadin.ui.Notification.Type)1 Panel (com.vaadin.ui.Panel)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 Buffered (com.vaadin.v7.data.Buffered)1 InvalidValueException (com.vaadin.v7.data.Validator.InvalidValueException)1