[FIX] website_event: unblock button when no reserve

In 11.0, this change e9454e79 solved the use case of:

- opening the registration of a ticket
- discard

=> the page must be reloaded to register a ticket

A new report is that since 9.0, if we try to register 0 ticket we would
also have to reload the page.

This commit backports e9454e79 and solves the 0 ticket registration.

opw-1851622
closes #24966
This commit is contained in:
Nicolas Lempereur
2018-06-01 10:53:30 +02:00
parent ea3b895589
commit 66a60c70f3
@@ -13,16 +13,23 @@ $(document).ready(function () {
ev.preventDefault();
ev.stopPropagation();
var $form = $(ev.currentTarget).closest('form');
var $button = $(this);
var post = {};
$("select").each(function() {
post[$(this)[0].name] = $(this).val();
});
ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) {
// Only needed for 9.0 up to saas-14
if (modal === false) {
$button.prop('disabled', false);
return;
}
var $modal = $(modal);
$modal.find('.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19
$modal.after($form).modal();
$modal.insertAfter($form).modal();
$modal.on('click', '.js_goto_event', function () {
$modal.modal('hide');
$button.prop('disabled', false);
});
});
});