$id, 'label' => $label, 'control' => $control, 'help' => $help ) );
};
$aieo_wl_num = static function ( $name, $value, $min, $max ) {
return \Rooster\Admin\Ui::input( $name, (string) (int) $value, array( 'id' => 'aieo-wl-' . str_replace( '_', '-', $name ), 'type' => 'number', 'xs' => true, 'min' => $min, 'max' => $max ) );
};
$aieo_wl_pair = static function ( $id, $label, $card_control, $card_id, $button_control, $button_id ) {
return \Rooster\Admin\Ui::field_row( array(
'id' => $id,
'label' => $label,
'parts' => array(
array( 'label' => __( 'Card', 'ai-eshop-optimizer' ), 'control' => $card_control, 'id' => $card_id ),
array( 'label' => __( 'Submit button', 'ai-eshop-optimizer' ), 'control' => $button_control, 'id' => $button_id ),
),
) );
};
$aieo_wl_color = static function ( $name, $id, $label ) use ( $settings ) {
return \Rooster\Admin\Fields::color( $name, AIEO_DMM_Waitlist::picked( $name, (string) ( $settings[ $name ] ?? '' ) ), array( 'id' => $id, 'default' => '', 'label' => $label ) );
};
list( $aieo_wl_open, $aieo_wl_close ) = AIEO_DMM_UI::card(
array(
'anchor' => 'waitlist-display-front-end-gate',
'footer' => class_exists( '\Rooster\Admin\States' ) ? $aieo_wl_save( 'waitlist-display-front-end-gate' ) : '',
'icon' => 'door-open',
'title' => __( 'Enable the waitlist form', 'ai-eshop-optimizer' ),
'description' => __( 'Off by default — keep PPE\'s wait-list module authoritative until you\'re ready to switch. When ON, Rooster One renders the form on every out-of-stock product page and PPE\'s output should be disabled to avoid duplicates.', 'ai-eshop-optimizer' ),
)
);
echo $aieo_wl_open;
ob_start();
echo '
'
. $aieo_wl_row( 'aieo-wl-frontend-enabled', __( 'Render front-end form', 'ai-eshop-optimizer' ), AIEO_Kit::check( 'frontend_enabled', __( 'Render the Rooster One waitlist form on out-of-stock products.', 'ai-eshop-optimizer' ), 'yes' === $settings['frontend_enabled'], array( 'id' => 'aieo-wl-frontend-enabled' ) ) )
. $aieo_wl_row( 'aieo-wl-display-on-backorders', __( 'Show on backorder products', 'ai-eshop-optimizer' ), AIEO_Kit::check( 'display_on_backorders', __( 'Also show the form when stock status is "on backorder".', 'ai-eshop-optimizer' ), 'yes' === $settings['display_on_backorders'], array( 'id' => 'aieo-wl-display-on-backorders' ) ) )
. '
';
echo $aieo_wl_form( 'waitlist-display-front-end-gate' );
echo $aieo_wl_close;
list( $aieo_wl_open, $aieo_wl_close ) = AIEO_DMM_UI::card(
array(
'anchor' => 'waitlist-display-form-text',
'footer' => class_exists( '\Rooster\Admin\States' ) ? $aieo_wl_save( 'waitlist-display-form-text' ) : '',
'icon' => 'text-cursor-input',
'title' => __( 'Form text', 'ai-eshop-optimizer' ),
'description' => __( 'The words on the form shoppers fill in to be told when a sold-out product is back.', 'ai-eshop-optimizer' ),
)
);
echo $aieo_wl_open;
ob_start();
echo ''
. $aieo_wl_row( 'aieo-wl-form-title', __( 'Form title', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'form_title', (string) $settings['form_title'], array( 'id' => 'aieo-wl-form-title' ) ) )
. $aieo_wl_row( 'aieo-wl-form-email-label', __( 'Email field label', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'form_email_label', (string) $settings['form_email_label'], array( 'id' => 'aieo-wl-form-email-label', 'medium' => true ) ) )
. $aieo_wl_row( 'aieo-wl-form-button-text', __( 'Submit button text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'form_button_text', (string) $settings['form_button_text'], array( 'id' => 'aieo-wl-form-button-text', 'medium' => true ) ) )
. $aieo_wl_row( 'aieo-wl-form-success-message', __( 'Success message', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::textarea( 'form_success_message', (string) $settings['form_success_message'], array( 'id' => 'aieo-wl-form-success-message', 'rows' => 2 ) ) )
. '
';
echo $aieo_wl_form( 'waitlist-display-form-text' );
echo $aieo_wl_close;
list( $aieo_wl_open, $aieo_wl_close ) = AIEO_DMM_UI::card(
array(
'anchor' => 'waitlist-display-appearance-card-button',
'footer' => class_exists( '\Rooster\Admin\States' ) ? $aieo_wl_save( 'waitlist-display-appearance-card-button' ) : '',
'icon' => 'palette',
'title' => __( 'Card and button appearance', 'ai-eshop-optimizer' ),
'description' => __( 'Style the form card on out-of-stock product pages. Leave a colour empty to use the theme\'s.', 'ai-eshop-optimizer' ),
)
);
echo $aieo_wl_open;
ob_start();
$aieo_wl_card = __( 'Card', 'ai-eshop-optimizer' );
$aieo_wl_button = __( 'Submit button', 'ai-eshop-optimizer' );
echo ''
. $aieo_wl_row( 'aieo-wl-title-size', __( 'Title size (px)', 'ai-eshop-optimizer' ), $aieo_wl_num( 'title_size', $settings['title_size'] ?? 16, 8, 48 ) )
. $aieo_wl_row( 'aieo-wl-text-size', __( 'Body text size (px)', 'ai-eshop-optimizer' ), $aieo_wl_num( 'text_size', $settings['text_size'] ?? 14, 8, 32 ), __( 'Drives label, email field, and submit-button text size.', 'ai-eshop-optimizer' ) )
. $aieo_wl_pair(
'aieo-wl-bg',
__( 'Background color', 'ai-eshop-optimizer' ),
$aieo_wl_color( 'bg_color', 'aieo-wl-bg-color', __( 'Background color', 'ai-eshop-optimizer' ) . ', ' . $aieo_wl_card ),
'aieo-wl-bg-color',
$aieo_wl_color( 'btn_bg_color', 'aieo-wl-btn-bg-color', __( 'Background color', 'ai-eshop-optimizer' ) . ', ' . $aieo_wl_button ),
'aieo-wl-btn-bg-color'
)
. $aieo_wl_pair(
'aieo-wl-border',
__( 'Border color', 'ai-eshop-optimizer' ),
$aieo_wl_color( 'border_color', 'aieo-wl-border-color', __( 'Border color', 'ai-eshop-optimizer' ) . ', ' . $aieo_wl_card ),
'aieo-wl-border-color',
$aieo_wl_color( 'btn_border_color', 'aieo-wl-btn-border-color', __( 'Border color', 'ai-eshop-optimizer' ) . ', ' . $aieo_wl_button ),
'aieo-wl-btn-border-color'
)
. $aieo_wl_pair( 'aieo-wl-border-w', __( 'Border thickness (px)', 'ai-eshop-optimizer' ), $aieo_wl_num( 'border_width', $settings['border_width'] ?? 1, 0, 10 ), 'aieo-wl-border-width', $aieo_wl_num( 'btn_border_width', $settings['btn_border_width'] ?? 0, 0, 10 ), 'aieo-wl-btn-border-width' )
. \Rooster\Admin\Ui::field_row( array(
'id' => 'aieo-wl-btn-text',
'label' => __( 'Text color', 'ai-eshop-optimizer' ),
'parts' => array(
array( 'label' => $aieo_wl_button, 'control' => $aieo_wl_color( 'btn_text_color', 'aieo-wl-btn-text-color', __( 'Text color', 'ai-eshop-optimizer' ) . ', ' . $aieo_wl_button ), 'id' => 'aieo-wl-btn-text-color' ),
),
) )
. '
';
echo $aieo_wl_form( 'waitlist-display-appearance-card-button' );
echo $aieo_wl_close;
list( $aieo_wl_open, $aieo_wl_close ) = AIEO_DMM_UI::card(
array(
'anchor' => 'waitlist-display-restock-notification-email',
'footer' => class_exists( '\Rooster\Admin\States' ) ? $aieo_wl_save( 'waitlist-display-restock-notification-email' ) : '',
'icon' => 'mail',
'title' => __( 'Restock notification email', 'ai-eshop-optimizer' ),
'description' => __( 'Out-of-stock products show a "Notify me" form. When the product flips back to in-stock, every subscriber gets an email — once.', 'ai-eshop-optimizer' ),
)
);
echo $aieo_wl_open;
ob_start();
echo '' . sprintf(
esc_html__( 'Use %1$s for the product name and %2$s for the product URL.', 'ai-eshop-optimizer' ),
'{product_name}',
'{product_url}'
) . '
';
echo ''
. $aieo_wl_row( 'aieo-wl-email-subject', __( 'Subject', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'email_subject', (string) $settings['email_subject'], array( 'id' => 'aieo-wl-email-subject' ) ) )
. $aieo_wl_row( 'aieo-wl-email-message', __( 'Body', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::textarea( 'email_message', (string) $settings['email_message'], array( 'id' => 'aieo-wl-email-message', 'rows' => 5 ) ) )
. '
';
echo $aieo_wl_form( 'waitlist-display-restock-notification-email' );
echo $aieo_wl_close;