Hi,
I'm trying to ask a question in the modal dialog in the EventMove (I also tried in the EventMoved) and if I answer cancel, I'd like to prevent moving.
The problem is that it doesn't work. Perhaps the cancel from the modal happens too late? This is my current code - I added now preventDefault before calling the modal, but in this case my modal result will have no effect.
What can I do to resolve this problem?
if (data.masterbook > 0) {
args.preventDefault();
// Moving booking series should be handled differently
const { Modal } = SW.serviceLoader;
const confirmAction = `${Resource.getLabel(EResourceLabel.MOVE)} ${Resource.getLabel(EResourceLabel.SERIES)}`;
const titleWarning = EResourceMessage.CONFIRM_ACTION_X_BOOKING_Y;
const self = this;
const modal = Modal.open({
scope: self.scope,
templateUrl: "app/templates/modals/confirmationModal",
controller($scope) {
$scope.okLabel = confirmAction;
$scope.cancelLabel = Resource.getLabel(EResourceLabel.CANCEL);
$scope.title = Resource.getMessage(titleWarning).format(confirmAction, data.booking_id);
$scope.message = Resource.getMessage(EResourceMessage.CONFIRM_MOVE_SERIES).format(args.newResource);
$scope.showSecondButton = true;
$scope.secondButtonLabel = Resource.getLabel(EResourceLabel.MOVE_SINGLE);
}
});
modal.result.then((type) => {
if (type === 1) {
self.logInfo("Moving Series");
} else {
self.logInfo("Moving Single");
}
}, () => {
args.preventDefault();
self.logInfo("Cancel of the modal called");
// self.scope.$apply();
});
}
Thanks in advance.