jQuery(document).ready(function ($) {
    'use strict';
    var cmplz_loader = '<div class="cmplz-loader"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div>';

    $(document).on('click', '.cmplz-archive-cookiebanner', function() {

        var banner_id = $(this).data('banner_id');
        var tr = $(this).closest('tr');
        tr.css('background-color','red');

        $.post(
            cmplz_statistics.admin_url,
            {
                action: 'cmplz_archive_cookiebanner',
                banner_id: banner_id,
            },
            function (response) {
                if (response) {
                    if (response.success){
                        tr.remove();
                    }

                }
            });
    });

    $(document).on('click', '.cmplz-restore-cookiebanner', function() {

        var banner_id = $(this).data('banner_id');
        var tr = $(this).closest('tr');
        tr.css('background-color','red');

        $.post(
            cmplz_statistics.admin_url,
            {
                action: 'cmplz_restore_cookiebanner',
                banner_id: banner_id,
            },
            function (response) {
                if (response.success) {
                    tr.remove();
                }
            });
    });

    
    
    function cmplz_localize(str){

        var strings = cmplz_statistics.translations;
        for (var k in strings) {
            if (strings.hasOwnProperty(k)) {
                str = str.replace(k, strings[k]);
            }
        }
        return str;
    }


});