<?php
/**
 * TAB: BEHAVIOR — Popup, map, checkout interaction settings (editable form)
 *
 * @package ParcelSelector
 * @since   3.1.1
 */

if ( ! defined( 'ABSPATH' ) ) exit;

if ( ! function_exists( 'parcselect_tab_behavior' ) ) {
function parcselect_tab_behavior() {
    $t       = parcselect_admin_i18n();
    $options = get_option( 'parcselect_paczkomaty_options', array() );
    $pickup  = get_option( 'parcselect_custom_pickup', array() );

    // Custom pickup defaults
    $pu_enabled    = ( $pickup['enabled']    ?? 'no' ) === 'yes';
    $pu_name       = $pickup['name']       ?? '';
    $pu_street     = $pickup['street']     ?? '';
    $pu_city       = $pickup['city']       ?? '';
    $pu_postal     = $pickup['postal']     ?? '';
    $pu_country    = $pickup['country']    ?? 'PL';
    $pu_lat        = $pickup['lat']        ?? '';
    $pu_lng        = $pickup['lng']        ?? '';
    $pu_desc       = $pickup['desc']       ?? '';
    $pu_hours      = $pickup['hours']      ?? '';
    $pu_label      = $pickup['label']      ?? __( 'Pick up your order locally', 'parcel-selector' );
    $pu_zoom_mode  = $pickup['zoom_mode']  ?? 'from_europe';
    $pu_show_first = ( $pickup['show_first'] ?? 'yes' ) === 'yes';
    $pu_highlight  = ( $pickup['highlight']  ?? 'yes' ) === 'yes';

    // Current values with safe defaults
    $shipping_cfg      = get_option( 'parcselect_shipping_config', array() );
    $ship_free         = ( $shipping_cfg['free']          ?? 'no' ) === 'yes';
    $ship_price        = isset( $shipping_cfg['price'] )        ? $shipping_cfg['price']        : '';
    $ship_delivery     = isset( $shipping_cfg['delivery_time'] ) ? $shipping_cfg['delivery_time'] : '';
    $ship_order_note   = isset( $shipping_cfg['order_note'] )   ? $shipping_cfg['order_note']   : '';

    $save_as_shipping  = isset( $options['ip_selected_as_shipping'] )          ? $options['ip_selected_as_shipping']          : 'yes';
    $epic_zoom         = isset( $options['parcselect_epic_zoom'] )                      ? $options['parcselect_epic_zoom']                     : 'no';
    $weight_limit      = isset( $options['ip_select_weight_limit'] )            ? $options['ip_select_weight_limit']           : 'no';
    $weight_max        = isset( $options['ip_select_weight_limit_value'] )      ? $options['ip_select_weight_limit_value']     : '25';
    $weight_result     = isset( $options['ip_select_weight_limit_result'] )     ? $options['ip_select_weight_limit_result']    : 'hide';
    $dim_limit         = isset( $options['ip_select_dimensions_limit'] )        ? $options['ip_select_dimensions_limit']       : 'no';
    $dim_width         = isset( $options['ip_select_dimensions_limit_width'] )  ? $options['ip_select_dimensions_limit_width'] : '';
    $dim_height        = isset( $options['ip_select_dimensions_limit_height'] ) ? $options['ip_select_dimensions_limit_height']: '';
    $dim_length        = isset( $options['ip_select_dimensions_limit_length'] ) ? $options['ip_select_dimensions_limit_length']: '';
    $shortcode_restore = isset( $options['save_shortcode_cart_checkout'] )      ? $options['save_shortcode_cart_checkout']     : 'no';
    ?>

    <div class="parcelselector-section">
        <h2>⚙️ <?php echo esc_html( $t['beh_title'] ); ?></h2>
        <p class="description"><?php echo esc_html( $t['beh_desc'] ); ?></p>
    </div>

    <form method="post" action="options.php">
        <input type="hidden" name="ps_save_group" value="parcselect_behavior_group">
        <?php settings_fields( 'parcselect_behavior_group' ); ?>

        <!-- ═══════════════ TIMING CONTROLS ═══════════════ -->
        <div class="parcelselector-section">
            <h3>⏱️ <?php echo esc_html( $t['beh_timing_performance'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <?php
                    $search_timeout = isset( $options['parcselect_search_timeout'] ) ? (float) $options['parcselect_search_timeout'] : 2.5;
                    $popup_delay    = isset( $options['parcselect_popup_delay'] )    ? (int) $options['parcselect_popup_delay']    : 30;
                    ?>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_auto_search_speed'] ); ?></th>
                        <td>
                            <div style="display:flex; align-items:center; gap:20px;">
                                <input type="range" name="parcselect_paczkomaty_options[ps_search_timeout]"
                                       min="0.5" max="5.0" step="0.1"
                                       value="<?php echo esc_attr($search_timeout); ?>"
                                       oninput="this.nextElementSibling.value = this.value + 's'">
                                <output style="font-weight:700; color:var(--ps-primary); width:50px; font-size:16px;"><?php echo esc_html($search_timeout); ?>s</output>
                            </div>
                            <p class="description"><?php echo esc_html( $t['beh_auto_search_desc'] ); ?></p>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_pre_popup_delay'] ); ?></th>
                        <td>
                            <div style="display:flex; align-items:center; gap:20px;">
                                <input type="range" name="parcselect_paczkomaty_options[ps_popup_delay]"
                                       min="5" max="60" step="1"
                                       value="<?php echo esc_attr($popup_delay); ?>"
                                       oninput="this.nextElementSibling.value = this.value + 's'">
                                <output style="font-weight:700; color:var(--ps-primary); width:50px; font-size:16px;"><?php echo esc_html($popup_delay); ?>s</output>
                            </div>
                            <p class="description"><?php echo esc_html( $t['beh_pre_popup_desc'] ); ?></p>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ SHIPPING PRICE & DELIVERY ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x1F4B0; <?php echo esc_html( $t['beh_shipping_price'] ?? 'Shipping Price & Delivery' ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_ship_free'] ?? 'Free Shipping' ); ?></th>
                        <td>
                            <label class="ps-switch-label">
                                <input type="checkbox"
                                       name="ps_shipping_config[free]"
                                       value="yes"
                                       id="ps-ship-free-toggle"
                                       <?php checked( $ship_free ); ?>>
                                <span class="ps-switch-text"><?php echo esc_html( $t['beh_ship_free_label'] ?? 'Enable free shipping (overrides price below)' ); ?></span>
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_ship_price'] ?? 'Shipping Price' ); ?></th>
                        <td>
                            <input type="number"
                                   name="ps_shipping_config[price]"
                                   value="<?php echo esc_attr( $ship_price ); ?>"
                                   min="0" step="0.01" style="width:120px;"
                                   placeholder="0.00">
                            <span style="margin-left:6px; color:var(--ps-text-dim);"><?php echo esc_html( get_woocommerce_currency_symbol() ); ?></span>
                            <p class="description"><?php echo esc_html( $t['beh_ship_price_desc'] ?? 'Default shipping cost. Used if the WooCommerce zone method has no price set. Ignored when Free Shipping is checked.' ); ?></p>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_ship_delivery'] ?? 'Estimated Delivery Time' ); ?></th>
                        <td>
                            <input type="text"
                                   name="ps_shipping_config[delivery_time]"
                                   value="<?php echo esc_attr( $ship_delivery ); ?>"
                                   class="regular-text"
                                   placeholder="<?php echo esc_attr( $t['beh_ship_delivery_ph'] ?? 'e.g. 1-2 business days' ); ?>">
                            <p class="description"><?php echo esc_html( $t['beh_ship_delivery_desc'] ?? 'Shown in order details and emails. Leave empty to hide.' ); ?></p>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_ship_note'] ?? 'Additional Order Note' ); ?></th>
                        <td>
                            <textarea name="ps_shipping_config[order_note]"
                                      rows="3"
                                      style="width:100%; max-width:500px;"
                                      placeholder="<?php echo esc_attr( $t['beh_ship_note_ph'] ?? 'Optional text shown in order details (e.g. packing instructions).' ); ?>"><?php echo esc_textarea( $ship_order_note ); ?></textarea>
                            <p class="description"><?php echo esc_html( $t['beh_ship_note_desc'] ?? 'Extra text appended to order details. Leave empty to hide.' ); ?></p>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ SHIPPING BEHAVIOR ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x1F4E6; <?php echo esc_html( $t['beh_shipping'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_save_as_shipping'] ); ?></th>
                        <td>
                            <label>
                                <input type="checkbox"
                                       name="parcselect_paczkomaty_options[ip_selected_as_shipping]"
                                       value="yes"
                                       <?php checked( $save_as_shipping, 'yes' ); ?>>
                                <?php echo esc_html( $t['beh_save_as_shipping'] ); ?>
                            </label>
                            <p class="description"><?php echo esc_html( $t['beh_save_as_shipping_desc'] ); ?></p>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ WEIGHT LIMITS ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x2696;&#xFE0F; <?php echo esc_html( $t['beh_weight'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_weight_enabled'] ); ?></th>
                        <td>
                            <label>
                                <input type="checkbox"
                                       name="parcselect_paczkomaty_options[ip_select_weight_limit]"
                                       value="yes"
                                       id="ps-weight-limit-toggle"
                                       <?php checked( $weight_limit, 'yes' ); ?>>
                                <?php echo esc_html( $t['beh_weight_enabled'] ); ?>
                            </label>
                        </td>
                    </tr>
                    <tr id="ps-weight-details" <?php echo $weight_limit !== 'yes' ? 'style="display:none"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static HTML attribute. ?>>
                        <th scope="row"><?php echo esc_html( $t['beh_weight_max'] ); ?></th>
                        <td>
                            <input type="number"
                                   name="parcselect_paczkomaty_options[ip_select_weight_limit_value]"
                                   value="<?php echo esc_attr( $weight_max ); ?>"
                                   min="0.1" max="999" step="0.1"
                                   style="width:80px"> kg
                        </td>
                    </tr>
                    <tr id="ps-weight-action" <?php echo $weight_limit !== 'yes' ? 'style="display:none"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static HTML attribute. ?>>
                        <th scope="row"><?php echo esc_html( $t['beh_weight_action'] ); ?></th>
                        <td>
                            <select name="parcselect_paczkomaty_options[ip_select_weight_limit_result]">
                                <option value="hide"    <?php selected( $weight_result, 'hide' ); ?>><?php echo esc_html( $t['beh_weight_hide'] ); ?></option>
                                <option value="disable" <?php selected( $weight_result, 'disable' ); ?>><?php echo esc_html( $t['beh_weight_disable'] ); ?></option>
                            </select>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ DIMENSION LIMITS ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x1F4D0; <?php echo esc_html( $t['beh_dimensions'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_dim_enabled'] ); ?></th>
                        <td>
                            <label>
                                <input type="checkbox"
                                       name="parcselect_paczkomaty_options[ip_select_dimensions_limit]"
                                       value="yes"
                                       id="ps-dim-limit-toggle"
                                       <?php checked( $dim_limit, 'yes' ); ?>>
                                <?php echo esc_html( $t['beh_dim_enabled'] ); ?>
                            </label>
                        </td>
                    </tr>
                    <tr id="ps-dim-details" <?php echo $dim_limit !== 'yes' ? 'style="display:none"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static HTML attribute. ?>>
                        <th scope="row">Max W &times; H &times; L (cm)</th>
                        <td>
                            <input type="number"
                                   name="parcselect_paczkomaty_options[ip_select_dimensions_limit_width]"
                                   value="<?php echo esc_attr( $dim_width ); ?>"
                                   placeholder="Width" min="0" step="0.1"
                                   style="width:70px"> &times;
                            <input type="number"
                                   name="parcselect_paczkomaty_options[ip_select_dimensions_limit_height]"
                                   value="<?php echo esc_attr( $dim_height ); ?>"
                                   placeholder="Height" min="0" step="0.1"
                                   style="width:70px"> &times;
                            <input type="number"
                                   name="parcselect_paczkomaty_options[ip_select_dimensions_limit_length]"
                                   value="<?php echo esc_attr( $dim_length ); ?>"
                                   placeholder="Length" min="0" step="0.1"
                                   style="width:70px"> cm
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ CHECKOUT MODE ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x1F6D2; <?php echo esc_html( $t['beh_checkout'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_classic_checkout'] ); ?></th>
                        <td>
                            <label>
                                <input type="checkbox"
                                       name="parcselect_paczkomaty_options[save_shortcode_cart_checkout]"
                                       value="yes"
                                       <?php checked( $shortcode_restore, 'yes' ); ?>>
                                <?php echo esc_html( $t['beh_classic_checkout'] ); ?>
                            </label>
                            <p class="description"><?php echo esc_html( $t['beh_classic_desc'] ); ?></p>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- ═══════════════ CUSTOM PICKUP POINT ═══════════════ -->
        <div class="parcelselector-section">
            <h3>🏠 <?php echo esc_html( $t['beh_custom_pickup'] ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_custom_pickup_enable'] ); ?></th>
                        <td>
                            <label class="ps-switch-label">
                                <input type="checkbox"
                                       name="ps_custom_pickup[enabled]"
                                       value="yes"
                                       id="ps-pickup-toggle"
                                       <?php checked( $pu_enabled ); ?>>
                                <span class="ps-switch-text"><?php echo esc_html( $t['beh_custom_pickup_map_msg'] ); ?></span>
                            </label>
                            <p class="description"><?php echo esc_html( $t['beh_custom_pickup_desc'] ); ?></p>
                        </td>
                    </tr>
                </table>

                <!-- ═══ SZCZEGÓŁY — widoczne gdy checkbox aktywny ═══ -->
                <div id="ps-pickup-details" <?php echo $pu_enabled ? '' : 'style="display:none"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static HTML attribute. ?>>
                    <hr style="margin:24px 0; border:none; border-top:1px solid var(--ps-border);">

                    <table class="form-table" role="presentation">
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_name'] ); ?></th>
                            <td>
                                <input type="text" name="ps_custom_pickup[name]" value="<?php echo esc_attr( $pu_name ); ?>" class="regular-text" placeholder="e.g. Store / Warehouse Warsaw">
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_street'] ); ?></th>
                            <td>
                                <input type="text" name="ps_custom_pickup[street]" value="<?php echo esc_attr( $pu_street ); ?>" class="regular-text" placeholder="e.g. 123 Main Street">
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_postal_city'] ); ?></th>
                            <td style="display:flex; gap:12px; align-items:center; flex-wrap:wrap;">
                                <input type="text" name="ps_custom_pickup[postal]" value="<?php echo esc_attr( $pu_postal ); ?>" style="width:100px;" placeholder="00-001">
                                <input type="text" name="ps_custom_pickup[city]" value="<?php echo esc_attr( $pu_city ); ?>" style="width:220px;" placeholder="City">
                                <select name="ps_custom_pickup[country]" style="width:100px;">
                                    <?php
                                    $countries_eu = array('PL');
                                    foreach ( $countries_eu as $code ) {
                                        printf( '<option value="%s"%s>%s</option>', esc_attr( $code ), selected( $pu_country, $code, false ), esc_html( $code ) );
                                    }
                                    ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_gps'] ); ?></th>
                            <td>
                                <div style="display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap;">
                                    <div>
                                        <label style="font-size:12px; color:var(--ps-text-dim); display:block; margin-bottom:4px;"><?php echo esc_html( $t['beh_pu_lat'] ); ?></label>
                                        <input type="number" id="ps-pickup-lat" name="ps_custom_pickup[lat]" value="<?php echo esc_attr( $pu_lat ); ?>" style="width:140px;" step="0.0000001">
                                    </div>
                                    <div>
                                        <label style="font-size:12px; color:var(--ps-text-dim); display:block; margin-bottom:4px;"><?php echo esc_html( $t['beh_pu_lng'] ); ?></label>
                                        <input type="number" id="ps-pickup-lng" name="ps_custom_pickup[lng]" value="<?php echo esc_attr( $pu_lng ); ?>" style="width:140px;" step="0.0000001">
                                    </div>
                                    <button type="button" id="ps-geocode-btn" class="parcelselector-btn parcelselector-btn-secondary">
                                        <?php echo esc_html( $t['beh_pu_fetch_btn'] ); ?>
                                    </button>
                                </div>
                                <p class="description" id="ps-geocode-status" style="margin-top:8px; min-height:1.2em;"></p>
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_hours'] ); ?></th>
                            <td>
                                <input type="text" name="ps_custom_pickup[hours]" value="<?php echo esc_attr( $pu_hours ); ?>" class="regular-text" placeholder="e.g. Mon–Fri 9:00–17:00">
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_additional_desc'] ); ?></th>
                            <td>
                                <textarea name="ps_custom_pickup[desc]" rows="2" style="width:100%; max-width:500px;" placeholder="Additional info for the customer..."><?php echo esc_textarea( $pu_desc ); ?></textarea>
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_label'] ); ?></th>
                            <td>
                                <input type="text" name="ps_custom_pickup[label]" value="<?php echo esc_attr( $pu_label ); ?>" class="regular-text">
                                <p class="description"><?php echo esc_html( $t['beh_pu_label_desc'] ); ?></p>
                            </td>
                        </tr>
                    </table>

                    <hr style="margin:24px 0; border:none; border-top:1px solid var(--ps-border);">
                    <h4 style="margin:0 0-16px; font-size:16px; font-weight:700;">⚙️ <?php echo esc_html( $t['beh_settings'] ?? 'Additional options' ); ?></h4>
                    <table class="form-table" role="presentation">
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_priority'] ); ?></th>
                            <td>
                                <label class="ps-switch-label">
                                    <input type="checkbox" name="ps_custom_pickup[show_first]" value="yes" <?php checked( $pu_show_first ); ?>>
                                    <span class="ps-switch-text"><?php echo esc_html( $t['beh_pu_priority_msg'] ); ?></span>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo esc_html( $t['beh_pu_highlight'] ); ?></th>
                            <td>
                                <label class="ps-switch-label">
                                    <input type="checkbox" name="ps_custom_pickup[highlight]" value="yes" <?php checked( $pu_highlight ); ?>>
                                    <span class="ps-switch-text"><?php echo esc_html( $t['beh_pu_highlight_msg'] ); ?></span>
                                </label>
                            </td>
                        </tr>
                    </table>

                    <hr style="margin:24px 0; border:none; border-top:1px solid var(--ps-border);">
                    <h4 style="margin:0 0 16px; font-size:16px; font-weight:700;">🎥 <?php echo esc_html( $t['beh_pu_animation'] ); ?></h4>
                    
                    <div class="ps-zoom-mode-grid">
                        <?php
                        $zoom_modes = array(
                            'direct'      => array( 'icon' => '📍', 'title' => $t['beh_pu_zoom_direct'], 'desc' => $t['beh_pu_zoom_direct_desc'] ),
                            'from_poland' => array( 'icon' => '🇵🇱', 'title' => $t['beh_pu_zoom_poland'], 'desc' => $t['beh_pu_zoom_poland_desc'] ),
                            'from_europe' => array( 'icon' => '🌍', 'title' => $t['beh_pu_zoom_europe'], 'desc' => $t['beh_pu_zoom_europe_desc'] ),
                            'from_world'  => array( 'icon' => '🌐', 'title' => $t['beh_pu_zoom_world'], 'desc' => $t['beh_pu_zoom_world_desc'] ),
                        );
                        foreach ( $zoom_modes as $mode_key => $mode ) :
                            $is_active = ( $pu_zoom_mode === $mode_key );
                        ?>
                        <label class="ps-zoom-mode-card <?php echo $is_active ? 'ps-zoom-active' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static CSS class. ?>">
                            <input type="radio" name="ps_custom_pickup[zoom_mode]" value="<?php echo esc_attr( $mode_key ); ?>" <?php checked( $is_active ); ?> style="display:none;">
                            <div class="ps-zoom-icon"><?php echo $mode['icon']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Emoji icon is static internal value.
?></div>
                            <div>
                                <div class="ps-zoom-title"><?php echo esc_html( $mode['title'] ); ?></div>
                                <div class="ps-zoom-desc"><?php echo esc_html( $mode['desc'] ); ?></div>
                            </div>
                            <?php if ( $is_active ) : ?>
                                <span class="ps-zoom-badge">Active</span>
                            <?php endif; ?>
                        </label>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>

        <!-- ═══════════════ SCAN TO DELIVER ═══════════════ -->
        <div class="parcelselector-section">
            <h3>&#x1F4F1; <?php echo esc_html( $t['beh_std_title'] ?? 'Scan to Deliver' ); ?></h3>
            <div class="parcelselector-card">
                <table class="form-table" role="presentation">
                    <?php
                    $std_enabled  = isset( $options['parcselect_std_enabled'] ) ? $options['parcselect_std_enabled'] : 'yes';
                    ?>
                    <tr>
                        <th scope="row"><?php echo esc_html( $t['beh_std_enable'] ?? 'Show QR code in point selection panel' ); ?></th>
                        <td>
                            <label class="ps-switch-label">
                                <input type="checkbox"
                                       name="parcselect_paczkomaty_options[ps_std_enabled]"
                                       value="yes"
                                       <?php checked( $std_enabled, 'yes' ); ?>>
                                <span class="ps-switch-text"><?php echo esc_html( $t['beh_std_enable_desc'] ?? '' ); ?></span>
                            </label>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <?php submit_button( $t['save_changes'] ?? 'Save Changes', 'parcelselector-btn parcelselector-btn-primary' ); ?>
    </form>
    <?php
}
}
