From 8bea6c8ba1c7df75762a4f870a3f092709c46de7 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 11 Apr 2024 17:19:15 +0200 Subject: [PATCH] #13344 jquery control date token --- .../godmode/users/configure_token.php | 26 ++++++++++++++++--- pandora_console/godmode/users/token_list.php | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/users/configure_token.php b/pandora_console/godmode/users/configure_token.php index 6b2f796edf..5f848f0104 100644 --- a/pandora_console/godmode/users/configure_token.php +++ b/pandora_console/godmode/users/configure_token.php @@ -122,7 +122,7 @@ $table->data[1][1] = html_print_input_text( 50, 255, true -); +).html_print_input_hidden('today_date', date('Y-m-d'), true); $table->data[1][2] = __('Expiration Time'); $table->data[1][3] = html_print_input_text( @@ -134,7 +134,7 @@ $table->data[1][3] = html_print_input_text( true ); -echo '
'; +echo ''; html_print_table($table); @@ -143,7 +143,7 @@ $actionButtons = []; if (empty($id_token) === true) { $actionButtons[] = html_print_submit_button( __('Create'), - 'crt', + 'next', false, ['icon' => 'wand'], true @@ -152,7 +152,7 @@ if (empty($id_token) === true) { } else { $actionButtons[] = html_print_submit_button( __('Update'), - 'upd', + 'next', false, ['icon' => 'update'], true @@ -201,4 +201,22 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript closeText: '' }); }); + + $('#button-next').on('click', function() { + event.preventDefault(); + var date = $('#text-date-expiration').val(); + if (date !== '') { + if (date < $('#hidden-today_date').val()) { + confirmDialog({ + title: "", + message: "", + hideCancelButton: true, + }); + } else{ + $('#form_token').submit(); + } + } else { + $('#form_token').submit(); + } + }) diff --git a/pandora_console/godmode/users/token_list.php b/pandora_console/godmode/users/token_list.php index 8090339187..f0a82bdca0 100644 --- a/pandora_console/godmode/users/token_list.php +++ b/pandora_console/godmode/users/token_list.php @@ -214,7 +214,7 @@ try { echo $e->getMessage(); } -echo ''; +echo ''; html_print_action_buttons( html_print_submit_button( __('Create Token'),