use of de.symeda.sormas.ui.caze.messaging.SmsComponent in project SORMAS-Project by hzi-braunschweig.
the class CaseController method sendSmsToAllSelectedItems.
public void sendSmsToAllSelectedItems(Collection<? extends CaseIndexDto> selectedRows, Runnable callback) {
if (selectedRows.size() == 0) {
new Notification(I18nProperties.getString(Strings.headingNoCasesSelected), I18nProperties.getString(Strings.messageNoCasesSelected), Type.WARNING_MESSAGE, false).show(Page.getCurrent());
} else {
final List<String> caseUuids = selectedRows.stream().map(caseIndexDto -> caseIndexDto.getUuid()).collect(Collectors.toList());
final SmsComponent smsComponent = new SmsComponent(FacadeProvider.getCaseFacade().countCasesWithMissingContactInformation(caseUuids, MessageType.SMS));
VaadinUiUtil.showConfirmationPopup(I18nProperties.getCaption(Captions.messagesSendingSms), smsComponent, I18nProperties.getCaption(Captions.actionSend), I18nProperties.getCaption(Captions.actionCancel), 640, confirmationEvent -> {
if (confirmationEvent.booleanValue()) {
FacadeProvider.getCaseFacade().sendMessage(caseUuids, "", smsComponent.getValue(), MessageType.SMS);
Notification.show(null, I18nProperties.getString(Strings.notificationSmsSent), Type.TRAY_NOTIFICATION);
}
});
}
}
Aggregations