<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* oc01/template//extension/module/newsletters.twig */
class __TwigTemplate_1e2f9d4526abcdb2a55709b83923c1c4a742f0cff7a6da81b89956c5150b0c3f extends \Twig\Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "<script>
    function regNewsletter()
    {
        var emailpattern = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+\$/;
        var email = \$('#txtemail').val();
        
        if(email != \"\")
        {
            if(!emailpattern.test(email))
            {
                \$(\"#text-danger-newsletter\").remove();
                \$(\"#form-newsletter-error\").removeClass(\"has-error\");
                \$(\"#newsletter-email\").append('<div class=\"text-danger\" id=\"text-danger-newsletter\">";
        // line 13
        echo ($context["error_news_email_invalid"] ?? null);
        echo "</div>');
                \$(\"#form-newsletter-error\").addClass(\"has-error\");

                return false;
            }
            else
            {
                \$.ajax({
                    url: 'index.php?route=extension/module/newsletters/add',
                    type: 'post',
                    data: 'email=' + \$('#txtemail').val(),
                    dataType: 'json',
                    async:false,

                    success: function(json) {

                        if (json.message == true) {                             
                            alert('";
        // line 30
        echo ($context["error_newsletter_sent"] ?? null);
        echo "');
                            document.getElementById(\"form-newsletter\").reset();
                            return true;                                                     
                        }
                        else {
                            \$(\"#text-danger-newsletter\").remove();
                            \$(\"#form-newsletter-error\").removeClass(\"has-error\");
                            \$(\"#newsletter-email\").append(json.message);
                            \$(\"#form-newsletter-error\").addClass(\"has-error\");
                        }

                    }
                });
                return false;
            }
        }
        else
        {

            \$(\"#text-danger-newsletter\").remove();
            \$(\"#form-newsletter-error\").removeClass(\"has-error\");
            \$(\"#newsletter-email\").append('<div class=\"text-danger\" id=\"text-danger-newsletter\">";
        // line 51
        echo ($context["error_news_email_required"] ?? null);
        echo "</div>');
            \$(\"#form-newsletter-error\").addClass(\"has-error\");

            return false;
        }
    }
     function regNewsletterpopup()
    {
        var emailpattern = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+\$/;
        var email = \$('#txtemailpopup').val();
        
        if(email != \"\")
        {
            if(!emailpattern.test(email))
            {
                \$(\"#text-danger-newsletter\").remove();
                \$(\"#form-newsletter-error-popup\").removeClass(\"has-error\");
                \$(\"#newsletter-emailp\").append('<div class=\"text-danger\" id=\"text-danger-newsletter\">";
        // line 68
        echo ($context["error_news_email_invalid"] ?? null);
        echo "</div>');
                \$(\"#form-newsletter-error-popup\").addClass(\"has-error\");

                return false;
            }
            else
            {
                \$.ajax({
                    url: 'index.php?route=extension/module/newsletters/add',
                    type: 'post',
                    data: 'email=' + \$('#txtemailpopup').val(),
                    dataType: 'json',
                    async:false,

                    success: function(json) {

                        if (json.message == true) {                             
                            alert('";
        // line 85
        echo ($context["error_newsletter_sent"] ?? null);
        echo "');
                            document.getElementById(\"form-newsletter\").reset();
                            \$(\".common-home #subscribe-me\").modal('hide');
                            return true;                                                     
                        }
                        else {
                            \$(\"#text-danger-newsletter\").remove();
                            \$(\"#form-newsletter-error-popup\").removeClass(\"has-error\");
                            \$(\"#newsletter-emailp\").append(json.message);
                            \$(\"#form-newsletter-error-popup\").addClass(\"has-error\");
                        }

                    }
                });
                return false;
            }
        }
        else
        {

            \$(\"#text-danger-newsletter\").remove();
            \$(\"#form-newsletter-error-popup\").removeClass(\"has-error\");
            \$(\"#newsletter-emailp\").append('<div class=\"text-danger\" id=\"text-danger-newsletter\">";
        // line 107
        echo ($context["error_news_email_required"] ?? null);
        echo "</div>');
            \$(\"#form-newsletter-error-popup\").addClass(\"has-error\");

            return false;
        }
    }
</script>



<div id=\"subscribe-me\" class=\"modal animated fade\" role=\"dialog\" data-keyboard=\"true\" tabindex=\"-1\">
<div class=\"newsletter-popup\">
<div class=\"newsletter-popup-static newsletter-popup-top\">
<div class=\"popup-text\">
<div class=\"popup-title\">";
        // line 121
        echo ($context["newsletter_static_title1"] ?? null);
        echo " <span>";
        echo ($context["newsletter_static_title2"] ?? null);
        echo "</span></div>
<div class=\"popup-desc\">
<div>";
        // line 123
        echo ($context["newsletter_static_desc1"] ?? null);
        echo "</div>
<div>";
        // line 124
        echo ($context["newsletter_static_desc2"] ?? null);
        echo "</div>
</div>
</div>
<div class=\"newsform\">    
    <form method=\"post\" class=\"form-horizontal\" id=\"form-newsletter-popup\">
        <div class=\"form-group\" id=\"form-newsletter-error-popup\">
            <div id=\"newsletter-emailp\">
                <input type=\"email\" class=\"form-control input-lg\" name=\"txtemailpopup\" id=\"txtemailpopup\" value=\"\" placeholder=\"";
        // line 131
        echo ($context["text_subscribe_placeholder"] ?? null);
        echo "\"/>
            <button type=\"submit\" onclick=\"return regNewsletterpopup();\" class=\"btn btn-default btn-lg\">                    
                    ";
        // line 133
        echo ($context["subscribe"] ?? null);
        echo "
                </button>
            </div>
            <div class=\"col-xs-12\">
                
                <label class=\"checkme\"><input type=\"checkbox\" value=\"\" id=\"checkme\"/>";
        // line 138
        echo ($context["chk_text"] ?? null);
        echo "</label>
            </div>
        </div>
    </form>
    
</div>
</div>
</div>
</div>


<div class=\"newsletters\">
<div class=\"news-head\">
<h4>";
        // line 151
        echo ($context["newsletter_title"] ?? null);
        echo "</h4>

</div>
<div class=\"news-form\">
    
    <form method=\"post\" class=\"form-horizontal\" id=\"form-newsletter\">
        <div class=\"form-group\" id=\"form-newsletter-error\">
               
             <div id=\"newsletter-email\">
                <input type=\"email\" name=\"txtemail\" id=\"txtemail\" value=\"\" placeholder=\"";
        // line 160
        echo ($context["text_subscribe_placeholder"] ?? null);
        echo "\" class=\"form-control\"/>
               <button type=\"submit\" onclick=\"return regNewsletter();\" id=\"email-popup-submit\" class=\"btn btn-default btn-lg\">                   
                    ";
        // line 162
        echo ($context["subscribe"] ?? null);
        echo "       </button>
           
            </div>
                
        </div>
    </form>
    
</div>  
</div>  ";
    }

    public function getTemplateName()
    {
        return "oc01/template//extension/module/newsletters.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  244 => 162,  239 => 160,  227 => 151,  211 => 138,  203 => 133,  198 => 131,  188 => 124,  184 => 123,  177 => 121,  160 => 107,  135 => 85,  115 => 68,  95 => 51,  71 => 30,  51 => 13,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "oc01/template//extension/module/newsletters.twig", "");
    }
}
