{"id":1663,"date":"2024-12-13T19:05:10","date_gmt":"2024-12-13T19:05:10","guid":{"rendered":"https:\/\/saveenergynv.org\/?page_id=1663"},"modified":"2025-07-28T22:34:53","modified_gmt":"2025-07-28T22:34:53","slug":"buscador-de-incentivos","status":"publish","type":"page","link":"https:\/\/saveenergynv.org\/es\/buscador-de-incentivos\/","title":{"rendered":"Buscador de incentivos"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-text-align-center\">Descubra su ahorro en electricidad\u00a0<\/h2>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\">Haga nuestro r\u00e1pido cuestionario para averiguar a qu\u00e9 incentivos, descuentos y cr\u00e9ditos fiscales tiene derecho gracias a la Ley para Reducir la Inflaci\u00f3n y otros programas de Nevada.<\/p>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n    <!-- HTML Form -->\n    <form id=\"incentives-form\">\n        <h2 class=\"incentives-form-title\">Datos de su hogar<\/h2>\n        <div class=\"field_group\">\n            <label for=\"owner_status\">Alquiler o propiedad<\/label>\n            <select id=\"owner_status\" name=\"owner_status\" required>\n                <option value=\"\">Seleccione<\/option>\n                <option value=\"homeowner\">Propietario<\/option>\n                <option value=\"renter\">Inquilino<\/option>\n            <\/select>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"street_address\">Direcci\u00f3n<\/label>\n            <input type=\"text\" id=\"street_address\" name=\"street_address\" required>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"zip\">C\u00f3digo postal<\/label>\n            <input type=\"text\" id=\"zip\" name=\"zip\" placeholder=\"C\u00f3digo postal de Nevada\" required>\n            <span class=\"zip-error\" style=\"color:red; font-size:12px;\"><\/span>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"state\">Estado<\/label>\n            <input type=\"text\" id=\"state\" name=\"state\" value=\"NV\" required disabled>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"city\">Ciudad<\/label>\n            <input type=\"text\" id=\"city\" name=\"city\" required>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"electric_utility\">Empresa de servicios p\u00fablicos<\/label>\n            <select id=\"electric_utility\" name=\"electric_utility\" required>\n                <option value=\"\">Seleccione su empresa de servicios p\u00fablicos<\/option>\n                <!-- Options will be populated based on zip code -->\n            <\/select>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"tax_filing\">Declaraci\u00f3n de impuestos<\/label>\n            <select id=\"tax_filing\" name=\"tax_filing\" required>\n                <option value=\"\">Seleccione<\/option>\n                <option value=\"single\">Soltero<\/option>\n                <option value=\"joint\">Casado que presenta una declaraci\u00f3n conjunta<\/option>\n                <option value=\"married_filing_separately\">Casado que presenta una declaraci\u00f3n por separado<\/option>\n                <option value=\"hoh\">Cabeza de familia<\/option>\n            <\/select>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"household_income\">Ingreso familiar<\/label>\n            <input type=\"number\" id=\"household_income\" name=\"household_income\" required>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"household_size\">Tama\u00f1o de la familia<\/label>\n            <select id=\"household_size\" name=\"household_size\" required>\n                <option value=\"\">Seleccione<\/option>\n                <option value=\"1\">1 persona<\/option><option value=\"2\">2 personas<\/option><option value=\"3\">3 personas<\/option><option value=\"4\">4 personas<\/option><option value=\"5\">5 personas<\/option><option value=\"6\">6 personas<\/option><option value=\"7\">7 personas<\/option><option value=\"8\">8 personas<\/option>            <\/select>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"email\">Correo electr\u00f3nico<\/label>\n            <input type=\"email\" id=\"email\" name=\"email\" required>\n            <span class=\"email-error\" style=\"color:red; font-size:12px;\"><\/span>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"first_name\">Nombre<\/label>\n            <input type=\"text\" id=\"first_name\" name=\"first_name\" required>\n        <\/div>\n        <div class=\"field_group\">\n            <label for=\"last_name\">Apellido<\/label>\n            <input type=\"text\" id=\"last_name\" name=\"last_name\" required>\n        <\/div>\n\n                <div class=\"field_group\" style=\"grid-column-start: 1; grid-column-end: 3;\">\n            <label>PROYECTOS EN LOS QUE EST\u00c1 INTERESADO: (ELIJA DE 1 A 3 PROYECTOS) <span class=\"project-limit-error\"><\/span><\/label>\n\n            \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1565\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1565\">\n                        Aislamiento T\u00e9rmico del Hogar                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1544\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1544\">\n                        Aparatos de cocina                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1559\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1559\">\n                        Auditor\u00eda Energ\u00e9tica                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1562\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1562\">\n                        Calefacci\u00f3n y Refrigeraci\u00f3n de Espacios                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1571\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1571\">\n                        Calentamiento de Agua                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1553\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1553\">\n                        El\u00e9ctrico                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1568\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1568\">\n                        Energ\u00eda Solar y Bater\u00edas                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1542\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1542\">\n                        Secadora de ropa                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1556\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1556\">\n                        Veh\u00edculos el\u00e9ctricos                    <\/label>\n                <\/div>\n\n                \n                <div class=\"checkbox-item\">\n                    <input \n                        type=\"checkbox\" \n                        id=\"project_1573\"\n                        name=\"interested_projects[]\" \n                        value=\"\"\n                    \/>\n                    <label for=\"project_1573\">\n                        Ventanas y Puertas                    <\/label>\n                <\/div>\n\n                        <\/div>\n        <!-- invisible reCAPTCHA token -->\n        <input type=\"hidden\" id=\"recaptcha_token\" name=\"recaptcha_token\">\n        <div class=\"submit_group\">\n            <button type=\"submit\">Enviar<\/button>\n            <p style=\"font-size:12px; line-height: 1.3em; margin-top: 20px;\">Al hacer clic en enviar, usted reconoce que podemos recolectar cierta informaci\u00f3n suya para proporcionarle recomendaciones y acepta recibir comunicaciones peri\u00f3dicas de la Nevada Conservation League y de organizaciones asociadas. Valoramos su privacidad y solo utilizaremos su informaci\u00f3n para mejorar su experiencia, de acuerdo con nuestra <a href=\"https:\/\/saveenergynv.org\/privacy-policy\/\">pol\u00edtica de privacidad<\/a>.<\/p>\n        <\/div>\n\n            <\/form>\n\n    <div id=\"incentives-results\"><\/div>\n\n    <!-- CSS Styles -->\n    <style>\n    #incentives-form {\n        max-width: 100%;\n        margin: 0 auto;\n        display: grid;\n        grid-template-columns: auto auto;\n        gap: 15px;\n        box-shadow: 0px 0px 10px #DDD;\n        padding: 25px;\n        border-radius: 20px;\n        background-color: #FFF;\n    }\n    #incentives-form .incentives-form-title {\n        grid-column-start: 1;\n        grid-column-end: 3;\n        margin: 0px;\n        font-size: 22px;\n    }\n\n    #incentives-form .field_group {\n        width: 100%;\n    }\n    #incentives-form label {\n        display: block;\n        margin-top: 10px;\n        font-size: 12px;\n        text-transform: uppercase;\n        font-weight: bold;\n    }\n\n    #incentives-form input[type=\"text\"],\n    #incentives-form input[type=\"select\"] {\n        width: 100%;\n        padding: 7px;\n        margin-top: 5px;\n        border-color: #AAA;\n        border-radius: 5px;\n    }\n    #incentives-form select {\n        width: 100%;\n        padding: 8px;\n        margin-top: 5px;\n        border-color: #AAA;\n        border-radius: 5px;\n    }\n\n    #incentives-form button {\n        margin-top: 20px;\n        padding: 10px 20px;\n        border: none;\n    }\n\n    #incentives-form .checkbox-item {\n        display: inline-block;\n        margin: 0px 12px 6px 0px;\n    }\n    #incentives-form input[type=\"checkbox\"] {\n        display: none;\n    }\n    #incentives-form input[type=\"checkbox\"] ~ label {\n        background-color: #EEF8EB;\n        box-shadow: 6px 5px 10px 0px rgba(0, 0, 0, .2);\n        border-radius: 50px;\n        padding: 10px 15px;\n        display: inline-block !important;\n        width: auto;\n        text-transform: capitalize !important;\n        color: #0032A1;\n        cursor: pointer;\n    }\n    #incentives-form input[type=\"checkbox\"]:checked ~ label,\n    #incentives-form input[type=\"checkbox\"] ~ label:hover {\n        background-color: #EEF8EB;\n        box-shadow: 6px 5px 10px 0px rgba(0, 0, 0, .2);\n        border-radius: 50px;\n        padding: 8px 13px;\n        display: inline-block !important;\n        width: auto;\n        text-transform: capitalize !important;\n        color: #0032A1;\n        border: 2px solid #0032A1;\n    }\n\n    #incentives-form .submit_group {\n        grid-column-start: 1; grid-column-end: 3;\n        text-align: center;\n    }\n\n    #incentives-results {\n        max-width: 800px;\n        margin: 40px auto;\n    }\n    .tabs-container {\n        display: flex;\n        gap: 10px;\n        margin-bottom: 20px;\n        flex-wrap: wrap;\n        justify-content: center;\n    }\n    .tab-button {\n        padding: 10px;\n        cursor: pointer;\n        border: none;\n        background-color: #f0f0f0;\n    }\n    .tab-button.active {\n        background-color: #007bff;\n        color: #fff;\n    }\n    .tabs-content {\n        display: flex;\n        flex-direction: column;\n    }\n    .tab-content {\n        display: none;\n    }\n    .tab-content.active {\n        display: block;\n    }\n    .incentive-card {\n        border: 0px solid #ccc;\n        padding: 20px;\n        margin-top: 20px;\n        box-shadow: 0px 0px 10px #DDD;\n        padding: 25px;\n        border-radius: 20px;\n        background-color: #FFF;\n    }\n\n    .incentive-card h3 {\n        color: #0032A1;\n        margin-top: 0;\n        font-size: 25px;\n        font-family: \"Poppins\", Sans-serif;\n        font-size: 32px;\n        font-weight: 600;\n        line-height: 1.4em;  \n    }\n    .incentive-amount {\n        font-size: 16px;\n    }\n    .badges-container {\n        display: flex;\n        flex-wrap: wrap;\n        gap: 10px;\n        margin-bottom: 10px;\n    }\n    .badge.item-badge {\n        font-size: 12px;\n        line-height: 12px;\n        text-transform: uppercase;\n        font-weight: bold;\n        background-color: #FFF;\n        border: 1px solid #333;\n        padding: 4px 7px;\n        border-radius: 5px;\n        margin-right: 0px;\n    }\n    \/* .badge.payment-method-badge {\n        font-size: 12px;\n        text-transform: uppercase;\n        font-weight: bold;\n        background-color: #EEE;\n        padding: 5px 8px;\n        border-radius: 5px;\n        margin-right: 10px;\n    } *\/\n    .badge.payment-method-badge {\n        font-family: 'Plus Jakarta Sans', sans-serif;\n        font-size: 12px;\n        font-weight: 700;\n        padding: 7px 16px;\n        background-color: #EEF8EB;\n        text-align: center;\n        display: block;\n        width: fit-content;\n        line-height: 1;\n        text-transform: uppercase;\n        color: #0032A1;\n        border-radius: 6px;\n        margin-top: 10px;\n    }\n    .badge.payment-method-badge.date-badge {\n        background-color: #FEF2CA;\n        color: #806C23;\n    }\n    .project-limit-error {\n        color: red;\n        font-style: italic;\n        text-transform: capitalize;\n    }\n    .loading-message {\n        font-size: 16px;\n        color: #333;\n        display: flex;\n        align-items: center;\n        gap: 10px;\n        padding: 10px 0;\n    }\n\n    .loading-message .spinner {\n        width: 16px;\n        height: 16px;\n        border: 2px solid #ccc;\n        border-top-color: #333;\n        border-radius: 50%;\n        animation: spin 0.6s linear infinite;\n    }\n\n    @keyframes spin {\n        to { transform: rotate(360deg); }\n    }\n    <\/style>\n\n    <!-- JavaScript Code -->\n    <script>\n    (function($) {\n\n        \/\/ Cache references to the form and checkboxes\n        const $form = $('#incentives-form');\n        const $checkboxes = $('input[name=\"interested_projects[]\"]');\n        const $errorSpan = $('.project-limit-error');\n      \n        \/\/ When any checkbox state changes\n        $checkboxes.change(function() {\n            \/\/ Count how many are currently checked\n            const checkedCount = $checkboxes.filter(':checked').length;\n            \n            \/\/ If user just checked a 4th box\n            if (checkedCount > 3) {\n            \/\/ Immediately uncheck it\n            $(this).prop('checked', false);\n            \n            \/\/ Show error message\n            $errorSpan.text('You can only select a maximum of 3 options.');\n            } else {\n            \/\/ If 3 or fewer are checked, clear any existing error\n            $errorSpan.text('');\n            }\n        });\n\n        \/\/ \/\/ Handle form submission\n        \/\/ $form.submit(function(event) {\n        \/\/     const checkedCount = $checkboxes.filter(':checked').length;\n\n        \/\/     \/\/ If zero checkboxes checked, show error and prevent submission\n        \/\/     if (checkedCount === 0) {\n        \/\/     event.preventDefault();\n        \/\/     $errorSpan.text('Please select at least one option before submitting.');\n        \/\/     } else {\n        \/\/     \/\/ Clear error if any, and allow submission\n        \/\/     $errorSpan.text('');\n        \/\/     }\n        \/\/ });\n\n\n        function validateZip() {\n            var zip = $('#zip').val().trim();\n            var ok  = \/^89\\d{3}$\/.test(zip);\n            if (!ok) {\n            $('.zip-error').text('Must be 5 digits starting with \u201c89\u201d');\n            \/\/console.log('ZIP invalid:', zip);\n            } else {\n            $('.zip-error').text('');\n            \/\/console.log('ZIP valid:', zip);\n            }\n            return ok;\n        }\n\n        function validateEmail() {\n            var email = $('#email').val().trim();\n            \/\/ at least one dot after the \u201c@\u201d\n            var ok    = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/.test(email);\n            if (!ok) {\n            $('.email-error').text('Enter a valid address (e.g. you@domain.com)');\n            \/\/console.log('Email invalid:', email);\n            } else {\n            $('.email-error').text('');\n            \/\/console.log('Email valid:', email);\n            }\n            return ok;\n        }\n\n        \/\/ blur events\n        $('#zip').on('blur',   validateZip);\n        $('#email').on('blur', validateEmail);\n\n        \/\/ Zip Code Change Event\n        $('#zip').on('change', function() {\n            var zipCode = $(this).val();\n            if(zipCode.length === 5 && \/^\\d+$\/.test(zipCode)) {\n                \/\/ Clear the electric utility dropdown\n                $('#electric_utility').empty().append('<option value=\"\">Loading...<\/option>');\n\n                \/\/ Make AJAX call to server-side function\n                $.ajax({\n                    url: 'https:\/\/saveenergynv.org\/wp-admin\/admin-ajax.php',\n                    type: 'POST',\n                    dataType: 'json',\n                    data: {\n                        action: 'get_electric_utilities',\n                        zip: zipCode,\n                    },\n                    success: function(response) {\n                        var $electricUtility = $('#electric_utility');\n                        $electricUtility.empty();\n                        if(response.success && response.data.utilities.length > 0) {\n                            $electricUtility.append('<option value=\"\">Select your utility<\/option>');\n                            $.each(response.data.utilities, function(index, utility) {\n                                $electricUtility.append('<option value=\"' + utility.id + '\">' + utility.name + '<\/option>');\n                            });\n                        } else {\n                            $electricUtility.append('<option value=\"\">No utilities found<\/option>');\n                        }\n                    },\n                    error: function(xhr, status, error) {\n                        console.error('Error:', error);\n                        $('#electric_utility').empty().append('<option value=\"\">Error loading utilities<\/option>');\n                    }\n                });\n            }\n        });\n\n        window.onIncentiveFormSubmit = function(token) {\n            if (token) {\n                \/\/console.log('Recaptcha token: ' + token);\n                \/\/document.getElementById('incentives-form').trigger('submit');\n                \/\/$('#incentives-form').trigger('submit');\n                $('#incentives-form .submit_group button[type=submit]').click();\n            }\n        }\n\n        $('#incentives-form').on('keydown', 'input', function(e) {\n            if (e.key === 'Enter') {\n                e.preventDefault();\n                return false;\n            }\n        });\n\n        \/\/ Form Submission Event\n        \/\/ $('#incentives-form').on('submit', function(e) {\n        \/\/     e.preventDefault();\n\n        \/\/     var zipOk   = validateZip();\n        \/\/     var emailOk = validateEmail();\n        \/\/     if (!zipOk || !emailOk) {\n        \/\/     \/\/ don\u2019t even check projects if zip\/email bad\n        \/\/     return;\n        \/\/     }\n\n        \/\/     \/\/ project-limit check\n        \/\/     var $boxes       = $('input[name=\"interested_projects[]\"]');\n        \/\/     var checkedCount = $boxes.filter(':checked').length;\n        \/\/     if (checkedCount === 0) {\n        \/\/     $('.project-limit-error').text('Please select at least 1 project.');\n        \/\/     console.log('Project count invalid: 0 selected');\n        \/\/     return;\n        \/\/     } else {\n        \/\/     $('.project-limit-error').text('');\n        \/\/     console.log('Project count valid:', checkedCount);\n        \/\/     }\n\n        \/\/     \/\/ all good \u2192 serialize and AJAX\n        \/\/     var formData = $(this).serializeArray();\n        \/\/     $.ajax({\n        \/\/     url: 'https:\/\/saveenergynv.org\/wp-admin\/admin-ajax.php',\n        \/\/     type: 'POST',\n        \/\/     dataType: 'json',\n        \/\/     data: {\n        \/\/         action:    'get_incentives',\n        \/\/         form_data: formData,\n        \/\/     },\n        \/\/     success: function(response) {\n        \/\/         displayIncentives(response);\n        \/\/     },\n        \/\/     error: function(xhr, status, error) {\n        \/\/         console.error('Error:', error);\n        \/\/     }\n        \/\/     });\n        \/\/ });\n\n        grecaptcha.ready(function(){\n            $('#incentives-form').on('submit', function(e){\n                e.preventDefault();\n\n                \/\/ 1) basic zip\/email validation\n                var zipOk   = validateZip();\n                var emailOk = validateEmail();\n                if (!zipOk || !emailOk) return;\n\n                \/\/ 2) run reCAPTCHA\n                grecaptcha.execute('6Len0CgrAAAAAE1D-FocRy6CdJDsGvAGxBPP8eLG', {\n                    action: 'get_incentives'\n                }).then(function(token){\n                    \/\/ put token in hidden field\n                    $('#recaptcha_token').val(token);\n\n                    \/\/ 3) project-limit check\n                    var $boxes       = $('input[name=\"interested_projects[]\"]');\n                    var checkedCount = $boxes.filter(':checked').length;\n                    if (checkedCount === 0) {\n                        $('.project-limit-error').text('Please select at least 1 project.');\n                        console.log('Project count invalid: 0 selected');\n                        return;\n                    }\n                    $('.project-limit-error').text('');\n\n                    \/\/ 4) Scroll to results and show loading message\n                    $('html, body').animate({\n                        scrollTop: $('#incentives-results').offset().top - 300\n                    }, 500);\n\n                    $('#incentives-results').html(`\n                        <div class=\"loading-message\">\n                            <span class=\"spinner\"><\/span>\n                            Retrieving incentives...\n                        <\/div>\n                    `);\n\n                    \/\/ 5) Serialize + include token\n                    var formData = $('#incentives-form').serializeArray();\n\n                    \/\/ 6) AJAX\n                    $.ajax({\n                        url: 'https:\/\/saveenergynv.org\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        dataType: 'json',\n                        data: {\n                            action:    'get_incentives',\n                            form_data: formData\n                        },\n                        success: displayIncentives,\n                        error: function(xhr, status, error){\n                            console.error('Error:', error);\n                            $('#incentives-results').html('<p style=\"color:red;\">An error occurred while retrieving incentives.<\/p>');\n                        }\n                    });\n                });\n            });\n        });\n\n\n        \/\/ $('#incentives-form').on('submit', function(e) {\n        \/\/     e.preventDefault();\n\n        \/\/     const checkedCount = $checkboxes.filter(':checked').length;\n\n        \/\/     \/\/ If zero checkboxes checked, show error and prevent submission\n        \/\/     if (checkedCount === 0) {\n        \/\/         $('.project-limit-error').text('Please select at least 1 project.');\n        \/\/         return;\n        \/\/     } else {\n        \/\/     \/\/ Clear error if any, and allow submission\n        \/\/         $('.project-limit-error').text('');\n        \/\/     }\n\n\n        \/\/     var formData = $(this).serializeArray();\n        \/\/     \/\/var formData = $(this).serialize();\n\n        \/\/     \/\/ Make AJAX call to server-side function\n        \/\/     $.ajax({\n        \/\/         url: 'https:\/\/saveenergynv.org\/wp-admin\/admin-ajax.php',\n        \/\/         type: 'POST',\n        \/\/         dataType: 'json',\n        \/\/         data: {\n        \/\/             action: 'get_incentives',\n        \/\/             form_data: formData,\n        \/\/         },\n        \/\/         success: function(response) {\n        \/\/             displayIncentives(response);\n        \/\/         },\n        \/\/         error: function(xhr, status, error) {\n        \/\/             console.error('Error:', error);\n        \/\/         }\n        \/\/     });\n        \/\/ });\n\n        function displayIncentives(data) {\n    const incentivesContainer = $('#incentives-results');\n    incentivesContainer.empty();\n\n    if (!data.success) {\n        incentivesContainer.append('<p>Error fetching incentives.<\/p>');\n        return;\n    }\n\n    const incentives = data.data.incentives;\n\n    \/\/ Category map generated dynamically via PHP\n    let categoryMap = {};\n    $.ajax({\n        url: '\/wp-admin\/admin-ajax.php',\n        type: 'POST',\n        data: {\n            action: 'get_category_map'\n        },\n        async: false,\n        success: function(response) {\n            categoryMap = response;\n        },\n        error: function() {\n            console.error('Error fetching category map. Defaulting to empty map.');\n        }\n    });\n    \/\/console.log(incentives);\n    if (incentives && incentives.length > 0) {\n        \/\/ Helper function to sanitize a string for use as an HTML id.\n        function sanitizeId(str) {\n            return str.toLowerCase().replace(\/\\s+\/g, '-').replace(\/[^\\w-]\/g, '');\n        }\n        \n        \/\/ Object to group incentives by sanitized category keys.\n        const groupedIncentives = {};\n        \/\/ Mapping from sanitized category key to the original category label.\n        const categoryLabels = {};\n\n        \/\/ Group incentives by category.\n        incentives.forEach((incentive) => {\n            \/\/ Use a Set to avoid duplicate categories\n            const categories = new Set();\n            incentive.items.forEach((item) => {\n                \/\/ Get raw category from categoryMap or default to \"Other\"\n                const rawCategory = categoryMap[item] || \"Other\";\n                \/\/ Sanitize the raw category so it can be used as an id.\n                const safeCategory = sanitizeId(rawCategory);\n                categories.add(safeCategory);\n                \/\/ Save the original name, only if not already stored.\n                if (!categoryLabels[safeCategory]) {\n                    categoryLabels[safeCategory] = rawCategory;\n                }\n            });\n\n            \/\/ Push the incentive into the grouped collection for each category.\n            categories.forEach((cat) => {\n                if (!groupedIncentives[cat]) {\n                    groupedIncentives[cat] = [];\n                }\n                groupedIncentives[cat].push(incentive);\n            });\n        });\n\n        \/\/ Helper function to render an individual incentive card.\n        \/\/ categoryOverride forces the category for the card (used in category-specific tabs),\n        \/\/ while in the \"All\" tab we compute one from the incentive itself.\n        function renderIncentiveCard(incentive, categoryOverride) {\n            const card = $('<div class=\"incentive-card\"><\/div>');\n            \/\/console.log('Rendering incentive card for:', incentive);\n            \/\/ Badges for each item.\n            const badgesContainer = $('<div class=\"badges-container items-badges\"><\/div>');\n            \/\/ incentive.items.forEach(item => {\n            \/\/     const formattedItem = item.replace(\/_\/g, ' ').replace(\/\\b\\w\/g, c => c.toUpperCase());\n            \/\/     const badge = $('<span class=\"badge item-badge\"><\/span>').text(formattedItem);\n            \/\/     badgesContainer.append(badge);\n            \/\/ });\n            incentive.items_display.forEach(item => {\n                const badge = $('<span class=\"badge item-badge\"><\/span>').text(item);\n                badgesContainer.append(badge);\n            });\n\n            card.append(badgesContainer);\n\n            \/\/ Title, amount, and description.\n            const title = $('<h3 class=\"incentive-title\"><\/h3>').text(incentive.program);\n            card.append(title);\n\n            let amount = '';\n            if (incentive.amount && incentive.amount.type === 'dollar_amount') {\n                amount = `$${incentive.amount.number}`;\n            } else if (incentive.amount && incentive.amount.type === 'percent') {\n                amount = `${incentive.amount.number * 100}%`;\n            }\n                        if (amount) {\n                card.append($('<p class=\"incentive-amount\"><\/p>').html(`<strong>Cantidad:<\/strong> ${amount}`));\n            }\n            card.append($('<p class=\"incentive-description\"><\/p>').text(incentive.short_description));\n\n            \/\/ Determine which category to use for the \"Explore how this works\" link.\n            let effectiveCategory = categoryOverride;\n            if (!effectiveCategory) {\n                \/\/ For the \"All\" tab, choose the first non-\"other\" category if possible.\n                const incentiveCategories = incentive.items.map(item =>\n                    sanitizeId(categoryMap[item] || \"Other\")\n                );\n                const incentiveCategorySlugs = incentive.items.map(item =>\n                    categoryMap[item + '-slug'] || \"Other\"\n                );\n                effectiveCategory = incentiveCategories.find(cat => cat !== 'other');\n                effectiveCategorySlug = incentiveCategorySlugs.find(cat => cat !== 'other');\n            } else {\n                \/\/ For category-specific tabs, use the passed category.\n                \/\/ console.log('Category override:', categoryOverride);\n                \/\/ console.log('Category map:', categoryMap);\n                \/\/ console.log('effectiveCategory:', effectiveCategory);\n                \/\/ effectiveCategorySlug = categoryMap[effectiveCategory + '-slug'] || \"Other\";\n                effectiveCategorySlug = effectiveCategory;\n            }\n            \n            \/\/ Build the links container.\n            const linksContainer = $('<div class=\"links-container\"><\/div>');\n            \/\/ Add \"Explore how this works\" only if the effective category exists and is not \"other\".\n            if (effectiveCategory && effectiveCategory !== 'other') {\n                const exploreLink = $('<a class=\"explore-link\"><\/a>')\n                    .attr('href', `\/project\/${effectiveCategorySlug}`)\n                    .text('Descubre c\u00f3mo funciona')\n                    .attr('target', '_blank');\n                linksContainer.append(exploreLink);\n                linksContainer.append(' | ');\n            }\n            \/\/ Always add the \"Detailed guidelines about project\" link.\n            const guidelinesLink = $('<a class=\"guidelines-link\"><\/a>')\n                .attr('href', incentive.more_info_url || incentive.program_url)\n                .text('M\u00e1s informaci\u00f3n sobre el proyecto')\n                .attr('target', '_blank');\n            linksContainer.append(guidelinesLink);\n\n            card.append(linksContainer);\n\n            \/\/ Payment method badges.\n            const paymentBadgesContainer = $('<div class=\"badges-container payment-methods-badges\"><\/div>');\n            \/\/ incentive.payment_methods.forEach(method => {\n            \/\/     const formattedMethod = method.replace(\/_\/g, ' ').replace(\/\\b\\w\/g, c => c.toUpperCase());\n            \/\/     const badge = $('<span class=\"badge payment-method-badge\"><\/span>').text(formattedMethod);\n            \/\/     paymentBadgesContainer.append(badge);\n            \/\/ });\n\n            incentive.payment_methods_display.forEach(method => {\n                const badge = $('<span class=\"badge payment-method-badge\"><\/span>').text(method);\n                paymentBadgesContainer.append(badge);\n            });\n\n            if (incentive.date_tag && incentive.date_tag.trim() !== '') {\n                const dateBadge = $('<span class=\"badge payment-method-badge date-badge\"><\/span>').text(incentive.date_tag);\n                paymentBadgesContainer.append(dateBadge);\n            }\n\n            card.append(paymentBadgesContainer);\n\n            return card;\n        }\n\n        \/\/ Create main containers for tabs and their content.\n        const tabsContainer = $('<div class=\"tabs-container\"><\/div>');\n        const tabsContent = $('<div class=\"tabs-content\"><\/div>');\n\n        \/\/ ----- Create the \"All\" Tab -----\n        const allTabButton = $('<button class=\"tab-button\"><\/button>')\n            .text(`All (${incentives.length})`)\n            .attr('data-tab', 'all')\n            .addClass('active');\n        tabsContainer.append(allTabButton);\n\n        const allTabContent = $('<div class=\"tab-content\"><\/div>')\n            .attr('id', 'all')\n            .addClass('active');\n\n        \/\/ Render each incentive card in the \"All\" tab.\n        incentives.forEach(incentive => {\n            const card = renderIncentiveCard(incentive, null);\n            allTabContent.append(card);\n        });\n        tabsContent.append(allTabContent);\n\n        \/\/ ----- Create sorted category tabs, ensuring that \"other\" comes at the end -----\n        \/\/ Filter out \"other\" (safe key is \"other\") and sort the rest alphabetically.\n        const sortedCategories = Object.keys(groupedIncentives)\n            .filter(cat => cat !== \"other\")\n            .sort((a, b) => a.localeCompare(b));\n        \/\/ Append \"other\" at the end if it exists.\n        if (groupedIncentives.hasOwnProperty(\"other\")) {\n            sortedCategories.push(\"other\");\n        }\n\n        \/\/ Render a tab and its content for each category.\n        sortedCategories.forEach((category) => {\n            \/\/ Get the original label from the mapping, or default to capitalized safe key.\n            const originalCategoryName = categoryLabels[category] || category.replace(\/-\/g, ' ').replace(\/\\b\\w\/g, c => c.toUpperCase());\n            const groupCount = groupedIncentives[category].length;\n            const tabButton = $('<button class=\"tab-button\"><\/button>')\n                .text(`${originalCategoryName} (${groupCount})`)\n                .attr('data-tab', category);\n            tabsContainer.append(tabButton);\n\n            const tabContent = $('<div class=\"tab-content\"><\/div>')\n                .attr('id', category);\n            groupedIncentives[category].forEach(incentive => {\n                \/\/ Pass the current sanitized category to force the correct link.\n                \/\/const card = renderIncentiveCard(incentive, category);\n                const card = renderIncentiveCard(incentive, null);\n                tabContent.append(card);\n            });\n            tabsContent.append(tabContent);\n        });\n\n        \/\/ Append the tabs container and the content container to the main incentives container.\n        incentivesContainer.append(tabsContainer).append(tabsContent);\n\n        \/\/ Handle tab switching.\n        $('.tab-button').on('click', function() {\n            const tabName = $(this).attr('data-tab');\n            $('.tab-button').removeClass('active');\n            $(this).addClass('active');\n            $('.tab-content').removeClass('active');\n            $(`#${tabName}`).addClass('active');\n        });\n    } else {\n        incentivesContainer.append('<p>No incentives found.<\/p>');\n    }\n}\n\n\n    })(jQuery);\n    <\/script>\n    \n","protected":false},"excerpt":{"rendered":"<p>Descubra su ahorro en electricidad\u00a0 Haga nuestro r\u00e1pido cuestionario para averiguar a qu\u00e9 incentivos, descuentos y cr\u00e9ditos fiscales tiene derecho gracias a la Ley para Reducir la Inflaci\u00f3n y otros programas de Nevada.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-1663","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/pages\/1663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/comments?post=1663"}],"version-history":[{"count":3,"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/pages\/1663\/revisions"}],"predecessor-version":[{"id":1666,"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/pages\/1663\/revisions\/1666"}],"wp:attachment":[{"href":"https:\/\/saveenergynv.org\/es\/wp-json\/wp\/v2\/media?parent=1663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}