HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpamazingsecret/wp-content/plugins_/woo-discount-rules/v2/Assets/Js/awdr_recipe.js
/* global jQuery, ajaxurl, wdr_data */
jQuery(document).ready(function ($) {

    $('.awdr_recipe_main_card').click(function () {
        let choose_recipe = $(this).attr("data-recipe-group");
        $('.'+choose_recipe).show();
        $('.awdr_recipe_main_card').each(function (index, element) {
            let hidden_recipe = $(element).attr("data-recipe-group");
            if(choose_recipe != hidden_recipe){
                $('.'+hidden_recipe).hide();
                $(element).css({"background-color": "#ffffff", "color": "#444444"})
            }else{
                $(element).css({"background-color": "#6495ed", "color": "#ffffff"})
            }
        });
    });


    /**
     * save rule
     */
    $(document).on('click', '.awdr_recipe_content', function () {
        var recipe_nonce = $(this).attr('data-recipe-nonce');
        var recipe_type = $(this).attr('data-select-recipe');
        var target_element = $(this).next();
        $.ajax({
            data: {
                method: 'create_rule_recipe',
                action: 'wdr_ajax',
                awdr_nonce: recipe_nonce,
                awdr_recipe_type: recipe_type,
            },
            type: 'post',
            url: ajaxurl,

            error: function (request, error) {
                notify(wdr_data.localization_data.error, 'error', alert_counter);
            },
            success: function (response) {
                var data = response.data;
                if (response.success) {
                    if (data.redirect && parseInt(data.rule_id) != 0) {
                        target_element.attr("href", data.redirect);
                        target_element.show();
                        target_element.css({"background-color": "#f3f5f6", "color": "#0071a1", "border-color": "#7e8993"})
                    } else {
                        $('.wdr_desc_text.coupon_error_msg').hide();
                        $(".coupon_name_msg").css("border", "");
                        notify(wdr_data.localization_data.save_rule, 'success', alert_counter);
                    }
                } else {
                    notify(wdr_data.localization_data.save_priority, 'success', alert_counter);
                }
            }
        });

    });

});