This commit is contained in:
Jonathan 2024-04-15 09:42:05 +02:00
parent 776cfb7350
commit ba1c013381
1 changed files with 20 additions and 7 deletions

View File

@ -202,21 +202,34 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
});
});
function errordate() {
confirmDialog({
title: "<?php echo __('Error'); ?>",
message: "<?php echo __('Expiration date must be later than today.'); ?>",
hideCancelButton: true,
});
}
$('#button-next').on('click', function() {
event.preventDefault();
var date = $('#text-date-expiration').val();
var time = date+' '+$('#text-time-expiration').val();
if (date !== '' || time !== '') {
if (date !== '' && $('#text-time-expiration').val() !== '') {
if (date < $('#hidden-today_date').val() || time < $('#hidden-today_date').val()+' '+$('#hidden-today_time').val()) {
confirmDialog({
title: "<?php echo __('Error'); ?>",
message: "<?php echo __('Expiration date must be later than today.'); ?>",
hideCancelButton: true,
});
console.log("ENTRO AQUI");
errordate();
} else{
$('#form_token').submit();
}
} else {
} else if (date !== '' && time === ' ') {
if (date < $('#hidden-today_date').val()) {
errordate();
} else{
$('#form_token').submit();
}
} else if (date === '' && time !== ' ') {
errordate();
}else {
$('#form_token').submit();
}
})