#13344 jquery control date token

This commit is contained in:
Jonathan 2024-04-11 17:19:15 +02:00
parent 06e7740234
commit 8bea6c8ba1
2 changed files with 23 additions and 5 deletions

View File

@ -122,7 +122,7 @@ $table->data[1][1] = html_print_input_text(
50, 50,
255, 255,
true true
); ).html_print_input_hidden('today_date', date('Y-m-d'), true);
$table->data[1][2] = __('Expiration Time'); $table->data[1][2] = __('Expiration Time');
$table->data[1][3] = html_print_input_text( $table->data[1][3] = html_print_input_text(
@ -134,7 +134,7 @@ $table->data[1][3] = html_print_input_text(
true true
); );
echo '<form class="max_floating_element_size" method="post" action="'.$url_list.'">'; echo '<form class="max_floating_element_size" id="form_token" method="post" action="'.$url_list.'">';
html_print_table($table); html_print_table($table);
@ -143,7 +143,7 @@ $actionButtons = [];
if (empty($id_token) === true) { if (empty($id_token) === true) {
$actionButtons[] = html_print_submit_button( $actionButtons[] = html_print_submit_button(
__('Create'), __('Create'),
'crt', 'next',
false, false,
['icon' => 'wand'], ['icon' => 'wand'],
true true
@ -152,7 +152,7 @@ if (empty($id_token) === true) {
} else { } else {
$actionButtons[] = html_print_submit_button( $actionButtons[] = html_print_submit_button(
__('Update'), __('Update'),
'upd', 'next',
false, false,
['icon' => 'update'], ['icon' => 'update'],
true true
@ -201,4 +201,22 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
closeText: '<?php echo __('Close'); ?>' closeText: '<?php echo __('Close'); ?>'
}); });
}); });
$('#button-next').on('click', function() {
event.preventDefault();
var date = $('#text-date-expiration').val();
if (date !== '') {
if (date < $('#hidden-today_date').val()) {
confirmDialog({
title: "<?php echo __('Error'); ?>",
message: "<?php echo __('Date expiration must be bigger than today.'); ?>",
hideCancelButton: true,
});
} else{
$('#form_token').submit();
}
} else {
$('#form_token').submit();
}
})
</script> </script>

View File

@ -214,7 +214,7 @@ try {
echo $e->getMessage(); echo $e->getMessage();
} }
echo '<form method="post" action="'.$edit_url.'">'; echo '<form method="post" id="" yaction="'.$edit_url.'">';
html_print_action_buttons( html_print_action_buttons(
html_print_submit_button( html_print_submit_button(
__('Create Token'), __('Create Token'),