var inpost_pl_geowidget_default_config; function inpost_pl_select_default_point_callback(point) { console.log( 'InPost PL plugin configuartion map callback' ); let point_name = ''; if ('name' in point) { point_name = point.name; if (point_name.startsWith( "PL_" )) { // Remove first 3 characters "PL_". point_name = point_name.slice( 3 ); } } console.log( 'InPost PL default point: ' + point_name ); let point_input = document.getElementById( 'easypack_default_machine_id' ); if (typeof point_input != 'undefined' && point_input !== null) { point_input.value = point_name; } if (typeof inpost_pl_geowidget_default_config != 'undefined' && inpost_pl_geowidget_default_config !== null) { inpost_pl_geowidget_default_config.close(); } } (function ($) { $( document ).ready( function () { let insurance_mode = $( 'input[name="easypack_insurance_amount_mode"]:checked' ).val(); let insurance_input = $( 'input[name="easypack_insurance_amount_default"]' ); let insurance_input_parent = $( insurance_input ).closest( 'tr' ); let webhook_url = easypack_settings.webhook_url; $( 'input[name="easypack_enable_webhooks_url"]' ).val( webhook_url ); if ('2' === insurance_mode) { $( insurance_input_parent ).show(); $( insurance_input ).attr( "required", true ); } else { $( insurance_input_parent ).hide(); $( insurance_input ).attr( "required", false ); } $( 'input[name="easypack_insurance_amount_mode"]' ).on( "change", function () { if ('2' === $( this ).val()) { $( insurance_input_parent ).show(); $( insurance_input ).attr( "required", true ); } else { $( insurance_input_parent ).hide(); $( insurance_input ).attr( "required", false ); } } ) let debug_text = ''; if (typeof easypack_settings.debug_notice != 'undefined' && easypack_settings.debug_notice !== null) { debug_text = '
' + easypack_settings.debug_notice + '
'; } if ($( '#easypack_js_map_button' ).is( ':checked' )) { $( '#easypack_button_output' ).prop( 'disabled', true ); $( '#easypack_button_output' ).closest( '.forminp-select' ).append( debug_text ); } else { $( '#easypack_button_output' ).prop( 'disabled', false ); $( '.easypack_debug_notice' ).each( function (ind, elem) { $( elem ).remove(); } ); } $( '#easypack_js_map_button' ).on( 'change', function () { if ($( this ).is( ':checked' )) { $( '#easypack_button_output' ).prop( 'disabled', true ); $( '#easypack_button_output' ).closest( '.forminp-select' ).append( debug_text ); } else { $( '#easypack_button_output' ).prop( 'disabled', false ); $( '.easypack_debug_notice' ).each( function (ind, elem) { $( elem ).remove(); } ); } } ); if ( ! $( '#easypack_set_default_courier_dimensions' ).is( ':checked' )) { $( '.easypack_hidden_setting' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).css( 'display', 'none' ); } ); } $( '#easypack_set_default_courier_dimensions' ).on( 'change', function () { if ($( this ).is( ':checked' )) { $( '.easypack_hidden_setting' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).fadeIn( 300 ); } ); } else { $( '.easypack_hidden_setting' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).fadeOut( 100 ); } ); } } ); $( '#easypack_api_url' ).closest( 'tr' ).css( 'display', 'none' ); $( '#easypack_geowidget_url' ).closest( 'tr' ).css( 'display', 'none' ); let webhook_setting = $( 'input[name="easypack_enable_webhooks"]' ); if (typeof webhook_setting != 'undefined' && webhook_setting !== null) { if ($( webhook_setting ).is( ':checked' )) { $( '.easypack_hidden_setting_webhook' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).show(); } ); } else { $( '.easypack_hidden_setting_webhook' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).hide(); } ); } $( 'input[name="easypack_enable_webhooks"]' ).on( "change", function () { if ($( this ).is( ':checked' )) { $( '.easypack_hidden_setting_webhook' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).fadeIn( 300 ); } ); } else { $( '.easypack_hidden_setting_webhook' ).each( function (i, elem) { let parent = $( elem ).closest( 'tr' ); $( parent ).fadeOut( 100 ); } ); } } ) } function easypack_show_tooltip(input, maxValue) { const $input = $( input ); const $tooltip = $( '