' . $aieo_rp_row(
'wpdatatables_table_id',
__('wpDataTables table id (optional, for the role price table)', 'ai-eshop-optimizer'),
\Rooster\Admin\Ui::input('wpdatatables_table_id', (string) $viewer_table_id, array('id' => $aieo_rp_id('wpdatatables_table_id'), 'type' => 'number', 'min' => '0', 'short' => true)),
$wpdt_active ? '' : __('wpDataTables plugin not detected; falls back to a native table.', 'ai-eshop-optimizer')
) . '';
$aieo_rp_card('role-pricing-enabled-roles', 'users', __('Enabled roles', 'ai-eshop-optimizer'), __('Tick the user roles that get their own prices, each of which becomes a price column in the CSV you upload.', 'ai-eshop-optimizer'), $aieo_rp_fields, array('col' => 1));
$badge_pos = isset($settings['archive_badge_position']) ? (string) $settings['archive_badge_position'] : 'image_top_left';
$aieo_rp_fields = '
' . $aieo_rp_row(
'archive_badge_position',
__('Archive badge layout', 'ai-eshop-optimizer'),
\Rooster\Admin\Ui::checks('archive_badge_position', array(
'image_top_left' => __('Top-left over the product image', 'ai-eshop-optimizer'),
'below_favourite' => __('Vertical column under the favourite/wishlist icon', 'ai-eshop-optimizer'),
), array($badge_pos), array(
'type' => 'radio',
'descriptions' => array(
'image_top_left' => __('the standard WooCommerce SALE flash position', 'ai-eshop-optimizer'),
'below_favourite' => __('top-right of the card, stacked downward beneath the heart', 'ai-eshop-optimizer'),
),
)),
'',
'',
true
) . '
';
$aieo_rp_card('role-pricing-archive-badge-layout', 'layout-grid', __('Archive badge layout', 'ai-eshop-optimizer'), __('Where the SALE / PRO / Free-Gift badges appear on shop archive product cards. Whichever option you pick, the badges always stack vertically in the order SALE → PRO → Free Gift so they never overlap.', 'ai-eshop-optimizer'), $aieo_rp_fields, array('col' => 2));
$aieo_rp_login_cluster = (bool) (class_exists('AIEO_DMM_Role_Pricing') ? AIEO_DMM_Role_Pricing::login_in_cluster() : false);
$aieo_rp_cluster_help = sprintf(
esc_html__('When ticked, the message becomes a draggable row you can position relative to Product Meta, Categories, etc. on %s. Archive pages keep showing it next to the price.', 'ai-eshop-optimizer'),
'' . esc_html__('Product Display → Display Order', 'ai-eshop-optimizer') . ''
);
$aieo_rp_fields = $aieo_rp_row('show_login_message', __('Show a message to guests inviting them to log in to see role prices', 'ai-eshop-optimizer'), $aieo_rp_switch('show_login_message', !empty($settings['show_login_message'])));
$aieo_rp_fields .= $aieo_rp_editor('aieo_dmm_login_message_text', 'login_message_text', __('Single-product message (HTML, may use {login_url})', 'ai-eshop-optimizer'), (string) ($settings['login_message_text'] ?? ''));
$aieo_rp_fields .= $aieo_rp_editor('aieo_dmm_login_message_archive', 'login_message_archive', __('Archive message (HTML, may use {login_url})', 'ai-eshop-optimizer'), (string) ($settings['login_message_archive'] ?? ''));
$aieo_rp_fields .= $aieo_rp_row('login_message_css_class', __('Custom CSS class', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::input('login_message_css_class', (string) ($settings['login_message_css_class'] ?? ''), array('id' => $aieo_rp_id('login_message_css_class'), 'medium' => true, 'code' => true)));
$aieo_rp_fields .= $aieo_rp_row('login_message_color', __('Link colour', 'ai-eshop-optimizer'), \Rooster\Admin\Fields::color('login_message_color', (string) ($settings['login_message_color'] ?? '#c82d52'), array('id' => $aieo_rp_id('login_message_color'), 'default' => '#c82d52')));
$aieo_rp_fields .= \Rooster\Admin\Ui::field_row(array(
'id' => $aieo_rp_id('font_archive'),
'label' => __('Archive / cards font size', 'ai-eshop-optimizer'),
'parts' => array(
$aieo_rp_px('login_message_font_archive_desktop', __('desktop (px)', 'ai-eshop-optimizer'), '14'),
$aieo_rp_px('login_message_font_archive_mobile', __('mobile (px)', 'ai-eshop-optimizer'), '12'),
),
));
$aieo_rp_fields .= \Rooster\Admin\Ui::field_row(array(
'id' => $aieo_rp_id('font_single'),
'label' => __('Single product font size', 'ai-eshop-optimizer'),
'parts' => array(
$aieo_rp_px('login_message_font_single_desktop', __('desktop (px)', 'ai-eshop-optimizer'), '16'),
$aieo_rp_px('login_message_font_single_mobile', __('mobile (px)', 'ai-eshop-optimizer'), '14'),
),
'help' => __('Leave a font size empty to inherit the theme size. Colour applies to the link in both contexts.', 'ai-eshop-optimizer'),
));
$aieo_rp_fields .= $aieo_rp_row('login_message_modal_enabled', __('On click, open a login modal (login form + social sign-in + the content below) instead of going to My Account', 'ai-eshop-optimizer'), $aieo_rp_switch('login_message_modal_enabled', !empty($settings['login_message_modal_enabled'])), __('Social sign-in shows only if you have enabled providers for the “login” intent under Social login.', 'ai-eshop-optimizer'));
$aieo_rp_fields .= $aieo_rp_editor('aieo_dmm_login_message_modal_content', 'login_message_modal_content', __('Modal content (rich text — e.g. a link to your professionals page)', 'ai-eshop-optimizer'), (string) ($settings['login_message_modal_content'] ?? ''), false);
$aieo_rp_fields .= $aieo_rp_row('login_message_in_cluster', __('Position the single-product message in the product info column (orderable) instead of attached to the price', 'ai-eshop-optimizer'), $aieo_rp_switch('login_message_in_cluster', $aieo_rp_login_cluster), '', $aieo_rp_cluster_help);
$aieo_rp_card('role-pricing-login-message', 'message-square-text', __('Login message', 'ai-eshop-optimizer'), __('Write the message that invites guests to log in to see role prices, and choose what opens when they click it.', 'ai-eshop-optimizer'),'
' . $aieo_rp_fields . '
', array('col' => 1, 'span' => 'all'));
$aieo_rp_fields = $aieo_rp_row('mini_cart_badge_icon', __('Icon', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::input('mini_cart_badge_icon', (string) ($settings['mini_cart_badge_icon'] ?? ''), array('id' => $aieo_rp_id('mini_cart_badge_icon'), 'xs' => true, 'placeholder' => '%')), __('Emoji, glyph or short HTML (e.g. ⓘ, %, an <img> tag). Leave empty to use just the text label.', 'ai-eshop-optimizer'));
$aieo_rp_fields .= $aieo_rp_row('mini_cart_badge_text', __('Text label', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::input('mini_cart_badge_text', (string) ($settings['mini_cart_badge_text'] ?? ''), array('id' => $aieo_rp_id('mini_cart_badge_text'), 'short' => true, 'placeholder' => 'PRO')), __('Short word shown next to the icon (1–4 characters works best). Plain text only.', 'ai-eshop-optimizer'));
$aieo_rp_fields .= $aieo_rp_row('mini_cart_badge_alt', __('Tooltip text (HTML)', 'ai-eshop-optimizer'), \Rooster\Admin\Ui::textarea('mini_cart_badge_alt', (string) ($settings['mini_cart_badge_alt'] ?? ''), array('id' => $aieo_rp_id('mini_cart_badge_alt'), 'rows' => 3, 'placeholder' => __('Defaults to the single-product message above when empty.', 'ai-eshop-optimizer'))), __('Shown when the badge is hovered (desktop) or tapped (mobile). May use {login_url}.', 'ai-eshop-optimizer'));
$aieo_rp_card('role-pricing-mini-cart-badge', 'shopping-cart', __('Mini-cart badge', 'ai-eshop-optimizer'), __('Compact form of the message above, shown next to the price on the side cart, recently viewed, and recommendation cards. Hovering / tapping the badge reveals the full message as a tooltip. Same gate as above (only shows to anonymous users on products with role pricing).', 'ai-eshop-optimizer'), '
' . esc_html(sprintf(
_n('Empties the role price table (%s product row now) and imports the file in its place.', 'Empties the role price table (%s product rows now) and imports the file in its place.', (int) $total_rows, 'ai-eshop-optimizer'),
number_format_i18n((int) $total_rows)
)) . '
' . esc_html__('Prices that are not in the file are gone afterwards.', 'ai-eshop-optimizer') . '