'food-beverages-settings', 'icon' => 'settings', 'title' => __( 'Settings', 'ai-eshop-optimizer' ), 'description' => __( 'Turn on the Food & Beverages toolset — product options & modifiers (sizes, toppings, with/without extras) now, and Wolt & eFood order-taking + menu sync soon. It is off by default, so shops that don’t sell food keep a clean admin with none of these screens.', 'ai-eshop-optimizer' ), 'footer' => \Rooster\Admin\States::save_button( 'aieo-food-form', array( 'label' => __( 'Save', 'ai-eshop-optimizer' ) ) ), ) ); echo $aieo_fb_open; $aieo_fb_ui = '\Rooster\Admin\Ui'; $aieo_fb_dep = \Rooster\Admin\States::depends_attrs( 'aieo-food-enabled', $enabled ); $aieo_fb_off = static function ( $id ) use ( $aieo_fb_ui ) { return $aieo_fb_ui::toggle( '', false, array( 'id' => $id, 'disabled' => true, 'label' => __( 'On', 'ai-eshop-optimizer' ), 'label_hidden' => true ) ); }; $aieo_fb_og_help = (string) preg_replace( '/^\s*—\s*/u', '', __( '— sizes, toppings, extras, with/without choices, per-option pricing & availability.', 'ai-eshop-optimizer' ) ); $aieo_fb_soon = (string) preg_replace( '/^\((.*)\)$/us', '$1', __( '(coming soon)', 'ai-eshop-optimizer' ) ); $aieo_fb_rows = $aieo_fb_ui::field_row( array( 'id' => 'aieo-food-enabled', 'label' => __( 'Enable Food & Beverages features', 'ai-eshop-optimizer' ), 'control' => $aieo_fb_ui::toggle( 'enabled', $enabled, array( 'id' => 'aieo-food-enabled', 'hidden' => false, 'label' => __( 'On', 'ai-eshop-optimizer' ), 'label_hidden' => true ) ), ) ) . $aieo_fb_ui::field_row( array( 'id' => 'aieo-food-feature-og', 'label' => __( 'Product options & modifiers', 'ai-eshop-optimizer' ), 'help' => $aieo_fb_og_help, 'attrs' => $aieo_fb_dep, 'control' => $aieo_fb_ui::toggle( 'feature_option_groups', $og_on, array( 'id' => 'aieo-food-feature-og', 'hidden' => false, 'label' => __( 'On', 'ai-eshop-optimizer' ), 'label_hidden' => true ) ), ) ) . $aieo_fb_ui::field_row( array( 'id' => 'aieo-food-wolt', 'label' => __( 'Wolt — orders & menu', 'ai-eshop-optimizer' ), 'reason' => $aieo_fb_soon, 'attrs' => $aieo_fb_dep, 'control' => $aieo_fb_off( 'aieo-food-wolt' ), ) ) . $aieo_fb_ui::field_row( array( 'id' => 'aieo-food-efood', 'label' => __( 'eFood — orders & catalog', 'ai-eshop-optimizer' ), 'reason' => $aieo_fb_soon, 'attrs' => $aieo_fb_dep, 'control' => $aieo_fb_off( 'aieo-food-efood' ), ) ); $aieo_fb_form = AIEO_DMM_UI::card_form( 'aieo_food_save_settings', 'food_beverages', 'aieo-food-form', '
' . $aieo_fb_rows . '
', array( 'nonce' => $nonce, 'nonce_name' => 'nonce' ) ); echo $aieo_fb_form; if ( $enabled && $og_on ) { $aieo_fb_note = sprintf( wp_kses_post( __( 'Product Options is active → manage your groups in %s, then attach them to a product from its “Options” tab.', 'ai-eshop-optimizer' ) ), '' . esc_html__( 'Product Options', 'ai-eshop-optimizer' ) . '' ); $aieo_fb_note = class_exists( '\Rooster\Admin\Ui' ) ? \Rooster\Admin\Ui::notice( $aieo_fb_note, 'info', array( 'inline' => true ) ) : '

' . $aieo_fb_note . '

'; echo $aieo_fb_note; } echo $aieo_fb_close; ?> __( 'Security check failed.', 'ai-eshop-optimizer' ) ) ); } if ( ! current_user_can( 'manage_woocommerce' ) ) { wp_send_json_error( array( 'message' => __( 'Not allowed.', 'ai-eshop-optimizer' ) ) ); } $enabled = ! empty( $_POST['enabled'] ); $og = ! empty( $_POST['feature_option_groups'] ); update_option( self::OPTION, array( 'enabled' => $enabled, 'features' => array( 'option_groups' => $og ), ), false ); wp_send_json_success( array( 'reload' => true ) ); } }