<?php

/* discount.form.tpl */
class __TwigTemplate_6d629b3c0be27f6602023ea14c7b3705 extends Twig_Template
{
    public function display(array $context)
    {
        // line 1
        $context['util'] = $this->env->loadTemplate("macros/util.tpl", true);
        // line 2
        $context['formBuilder'] = $this->env->loadTemplate("macros/forms.tpl", true);
        echo "<form enctype=\"multipart/form-data\" action=\"index.php?ToDo=";
        // line 3
        echo twig_safe_filter((isset($context['FormAction']) ? $context['FormAction'] : null));
        echo "\" id=\"frmNews\" method=\"post\" onSubmit=\"return CheckDiscountRuleForm()\">
\t<input type=\"hidden\" id=\"discountId\" name=\"discountId\" value=\"";
        // line 4
        echo twig_safe_filter((isset($context['DiscountId']) ? $context['DiscountId'] : null));
        echo "\">
\t<style>.Field20{width: auto !important; display: inline}</style>
\t<div class=\"row\">
\t\t<div class=\"col-sm-12\">
\t\t\t<h4 class=\"page-title\">";
        // line 8
        echo twig_safe_filter((isset($context['Title']) ? $context['Title'] : null));
        echo "</h4>
\t\t\t<p>";
        // line 9
        echo twig_safe_filter((isset($context['Intro']) ? $context['Intro'] : null));
        echo "</p>
\t\t\t";
        // line 10
        echo twig_safe_filter((isset($context['Message']) ? $context['Message'] : null));
        echo "
\t\t</div>
\t</div>

\t<div class=\"row\">
\t\t<div class=\"col-sm-12\">
\t\t\t<input type=\"submit\" value=\"";
        // line 16
        echo getLang("SaveAndExit");
        echo "\" class=\"btn btn-primary\" name=\"SaveButton1\" />
\t\t\t<input type=\"reset\" value=\"";
        // line 17
        echo getLang("Cancel");
        echo "\" class=\"btn btn-default\" name=\"CancelButton1\" onclick=\"ConfirmCancel()\" />
\t\t</div>
\t</div>
\t<br />

\t<div class=\"panel panel-default form-horizontal\">
\t\t<div class=\"panel-heading\"> 
\t\t\t<h3 class=\"panel-title\">";
        // line 24
        echo getLang("NewDiscountDetails");
        echo "</h3> 
\t\t</div> 

\t\t<div class=\"panel-body\"> 
\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\">";
        // line 29
        echo getLang("DiscountFormRuleName");
        echo "</label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t<input type=\"text\" id=\"discountname\" name=\"discountname\" class=\"form-control\" value=\"";
        // line 31
        echo twig_safe_filter((isset($context['DiscountName']) ? $context['DiscountName'] : null));
        echo "\" />
\t\t\t\t\t<span class=\"help-block\"><small>Como 'Frete grátis em pedidos acima de R\$200'. Esse nome serve somente para sua referência.</small></span>
\t\t\t\t</div>
\t\t\t</div>

\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\">";
        // line 37
        echo getLang("DiscountFormEnabled");
        echo "</label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" value=\"1\" ";
        // line 40
        echo twig_safe_filter((isset($context['DiscountEnabledCheck']) ? $context['DiscountEnabledCheck'] : null));
        echo ">
\t\t\t\t\t\t<label>";
        // line 41
        echo getLang("DiscountFormEnabledDescription");
        echo "</label>
\t\t            </div>
\t\t        </div>
\t\t    </div>

\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\">";
        // line 47
        echo getLang("DiscountFormRuleExpires");
        echo "</label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input type=\"checkbox\" name=\"discountruleexpires\" id=\"discountruleexpires\"  ";
        // line 50
        echo twig_safe_filter((isset($context['DiscountExpiryCheck']) ? $context['DiscountExpiryCheck'] : null));
        echo " onclick=\"if(this.checked) { \$('.DiscountExpiryFields').show(); } else { \$('.DiscountExpiryFields').hide(); }\" value=\"1\" />
\t\t\t\t\t\t<label>";
        // line 51
        echo getLang("DiscountFormRuleExpiresDescription");
        echo "</label>
\t\t            </div>
\t\t            <div style=\"display:none\" id=\"rulexpires\"></div>
\t\t            <br />
\t\t            <div style=\"margin-top: 3px; padding-left:20px; ";
        // line 55
        echo twig_safe_filter((isset($context['DiscountExpiryFields']) ? $context['DiscountExpiryFields'] : null));
        echo "\" class=\"DiscountExpiryFields\">
\t\t\t\t\t\t<div class=\"col-md-8 form-group\">
                            <div class=\"input-group\">
                            \t<span class=\"input-group-addon\">
                              \t\t<input name=\"discountruleexpiresuses\" id=\"discountruleexpiresuses\" onclick=\"\$('#discountruleexpiresusesamount').attr('readonly', !\$('#discountruleexpiresusesamount').attr('readonly'));\" type=\"checkbox\">
                                </span>
                                <span class=\"input-group-addon\">Tornar esta regra de desconto inativa após</span>
                                <input name=\"discountruleexpiresusesamount\" id=\"discountruleexpiresusesamount\" class=\"form-control\" value=\"1\" onclick=\"\$('#discountruleexpiresusesamount').attr('readonly', false);\$('#discountruleexpiresuses').attr('checked', true);\"> 
                                <span class=\"input-group-addon\">uso(s)</span>
                            </div>
                        </div>
\t\t            </div>
\t\t        </div>
\t\t    </div>
\t\t</div>
\t</div>

\t<div class=\"panel panel-default form-horizontal\">
\t\t<div class=\"panel-heading\"> 
\t\t\t<h3 class=\"panel-title\">Tipo de Desconto</h3> 
\t\t</div> 

\t\t<div class=\"panel-body\"> 
\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\">";
        // line 79
        echo getLang("DiscountFormRuleType");
        echo "</label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t";
        // line 81
        echo twig_safe_filter((isset($context['RuleList']) ? $context['RuleList'] : null));
        echo "
\t\t\t\t</div>
\t\t\t</div>
\t\t</div>
\t</div>

\t<div class=\"panel panel-default form-horizontal\" id=\"FreeShipingDiscountRulesOptionsSection\" style=\"display: none\">
\t\t<div class=\"panel-heading\"> 
\t\t\t<h3 class=\"panel-title\">Tipo de Desconto</h3> 
\t\t</div> 

\t\t<div class=\"panel-body\"> 
\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\">";
        // line 94
        echo getLang("FreeShippingMessage");
        echo "</label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t<textarea name=\"FreeShippingMessage\" id=\"FreeShippingMessage\" class=\"form-control\" rows=\"5\">Gaste mais %%REMAINING_AMOUNT%% para se qualificar para frete grátis!</textarea>
\t\t\t\t</div>
\t\t\t</div>

\t\t\t<div class=\"form-group\">
\t\t\t\t<label class=\"col-md-2 control-label\"></label>
\t\t\t\t<div class=\"col-md-10\">
\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input name=\"ShowFreeShippingMesgOn[homepage]\" class=\"ShowFreeShippingMesgOn\" id=\"ShowFreeShippingMesgOnHomePage\" value=\"homepage\" type=\"checkbox\">
\t\t\t\t\t\t<label for=\"ShowFreeShippingMesgOnHomePage\"> Exibir a mensagem de frete grátis na página principal</label>
\t\t            </div>

\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input name=\"ShowFreeShippingMesgOn[productpage]\" class=\"ShowFreeShippingMesgOn\" id=\"ShowFreeShippingMesgOnProductPage\" value=\"productpage\" type=\"checkbox\">
\t\t\t\t\t\t<label for=\"ShowFreeShippingMesgOnProductPage\"> Exibir a mensagem de frete grátis na página do produto</label>
\t\t            </div>

\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input name=\"ShowFreeShippingMesgOn[cartpage]\" class=\"ShowFreeShippingMesgOn\" id=\"ShowFreeShippingMesgOnCartPage\" value=\"cartpage\" type=\"checkbox\">
\t\t\t\t\t\t<label for=\"ShowFreeShippingMesgOnCartPage\"> Exibir a mensagem de frete grátis na página do carrinho</label>
\t\t            </div>

\t\t\t\t\t<div class=\"checkbox checkbox-primary\">
\t\t\t\t\t\t<input name=\"ShowFreeShippingMesgOn[checkoutpage]\" class=\"ShowFreeShippingMesgOn\" id=\"ShowFreeShippingMesgOnCheckoutPage\" value=\"checkoutpage\" type=\"checkbox\">
\t\t\t\t\t\t<label for=\"ShowFreeShippingMesgOnCheckoutPage\"> Exibir a mensagem de frete grátis na página de finalização da compra</label>
\t\t            </div>
\t\t        </div>
\t\t    </div>
\t\t</div>
\t</div>

\t<div class=\"row\">
\t\t<div class=\"col-sm-12\">
\t\t\t<input type=\"submit\" value=\"";
        // line 129
        echo getLang("SaveAndExit");
        echo "\" class=\"btn btn-primary\" name=\"SaveButton1\" />
\t\t\t<input type=\"reset\" value=\"";
        // line 130
        echo getLang("Cancel");
        echo "\" class=\"btn btn-default\" name=\"CancelButton1\" onclick=\"ConfirmCancel()\" />
\t\t</div>
\t</div>
</form>

<script type=\"text/javascript\">
\tvar previous = ";
        // line 136
        echo twig_safe_filter((isset($context['CurrentRule']) ? $context['CurrentRule'] : null));
        echo ";

\tfunction ConfirmCancel()
\t{
\t\tif(confirm(\"";
        // line 140
        echo getLang("ConfirmCancelDiscount");
        echo "\"))
\t\t\tdocument.location.href = \"index.php?ToDo=viewDiscounts\";
\t}

\t\tfunction VendorSupport() {
\t\t\t\talert('";
        // line 145
        echo getLang("DiscountVendorWarning");
        echo "');
\t\t}

\t\tfunction UpdateModule(module, vendor) {

\t\t\tif (";
        // line 150
        echo twig_safe_filter((isset($context['Vendor']) ? $context['Vendor'] : null));
        echo " && !vendor) {
\t\t\t\t\$('#'+module).attr('checked', false);
\t\t\t\t\$('#'+previous).attr('checked', true);
\t\t\t\talert('";
        // line 153
        echo getLang("DiscountVendorWarning");
        echo "');
\t\t\t\treturn;
\t\t\t}

\t\t\tprevious = module;

\t\t\tif(module == '' || module == null) {
\t\t\t\treturn;
\t\t\t}

\t\t\t\$.ajax({
\t\t\t\t'url': 'remote.php',
\t\t\t\t'method': 'post',
\t\t\t\t'data': {
\t\t\t\t\t'remoteSection': 'discounts',
\t\t\t\t\t'w': 'getRuleModuleProperties',
\t\t\t\t\t'module': module
\t\t\t\t},
\t\t\t\t'success': function(data) {
\t\t\t\t\t\$('.ruleWrapper').hide();
\t\t\t\t\t\$('.ruleSettings').html('');
\t\t\t\t\t\$('#ruleSettings'+module).html(data);
\t\t\t\t\t\$('#ruleWrapper'+module).show();
\t\t\t\t\t\$('.discountFirst').focus();

\t\t\t\t}
\t\t\t});
\t\t}

\t\tfunction CheckDiscountRuleForm()
\t\t{
\t\t\tvar discountname = document.getElementById(\"discountname\");
\t\t\tvar discountruleexpires = document.getElementById(\"discountruleexpires\");
\t\t\tvar discountruleexpiresuses = document.getElementById(\"discountruleexpiresuses\");
\t\t\tvar discountruleexpiresusesamount = document.getElementById(\"discountruleexpiresusesamount\");
\t\t\tvar discountruleexpiresdate = document.getElementById(\"discountruleexpiresdate\");
\t\t\tvar discountruleexpiresdateamount = document.getElementById(\"discountruleexpiresdateamount\");
\t\t\tvar enabled = document.getElementById(\"enabled\");

\t\t\tvar type = document.getElementsByName(\"RuleType\");

\t\t\tif(discountname.value == \"\") {
\t\t\t\talert(\"";
        // line 195
        echo getLang("EnterDiscountName");
        echo "\");
\t\t\t\tdiscountname.focus();
\t\t\t\treturn false;
\t\t\t}

\t\t\tif (discountruleexpires.checked) {
\t\t\t\tif (discountruleexpiresuses.checked) {
\t\t\t\t\tif (isNaN(discountruleexpiresusesamount.value)) {
\t\t\t\t\t\talert(\"";
        // line 203
        echo getLang("EnterDiscountExpiresUsesAmount");
        echo "\");
\t\t\t\t\t\tdiscountruleexpiresusesamount.focus();
\t\t\t\t\t\tdiscountruleexpiresusesamount.select();
\t\t\t\t\t\treturn false;
\t\t\t\t\t}
\t\t\t\t}

\t\t\t\tif (discountruleexpiresdate.checked) {
\t\t\t\t\tif (discountruleexpiresdateamount.value == '' || new Date(discountruleexpiresdateamount.value) == 'Invalid Date') {
\t\t\t\t\t\talert(\"";
        // line 212
        echo getLang("EnterDiscountExpiresDateAmount");
        echo "\");
\t\t\t\t\t\tdiscountruleexpiresdateamount.focus();
\t\t\t\t\t\tdiscountruleexpiresdateamount.select();
\t\t\t\t\t\treturn false;
\t\t\t\t\t}
\t\t\t\t}
\t\t\t}
\t\t\tvar checked = false;
\t\t\tfor (var i = 0; i < type.length; i++) {
\t\t\t\tif (type[i].checked) {

\t\t\t\t\tvar response = this[type[i].id]();

\t\t\t\t\tif (response == true)
\t\t\t\t\t{
\t\t\t\t\t\tchecked = true;
\t\t\t\t\t\tbreak;
\t\t\t\t\t}

\t\t\t\t\treturn false;
\t\t\t\t}
\t\t\t}

\t\t\tif (!checked) {
\t\t\t\talert(\"";
        // line 236
        echo getLang("EnterDiscountSelectRule");
        echo "\");
\t\t\t\treturn false;
\t\t\t}

\t\t\tif (\$(\".discountRadio:checked\").val() == 'rule_buyxgetfreeshipping'
\t\t\t|| \$(\".discountRadio:checked\").val() == 'rule_freeshippingwhenoverx') {
\t\t\t\tif (\$.trim(\$(\"#FreeShippingMessage\").val()) == '') {
\t\t\t\t\talert(\"";
        // line 243
        echo getLang("EnterFreeShippingMessage");
        echo "\");
\t\t\t\t\t\$(\"#FreeShippingMessage\").focus();
\t\t\t\t\treturn false;
\t\t\t\t}
\t\t\t\tif (\$(\".ShowFreeShippingMesgOn:checked\").length <= 0) {
\t\t\t\t\talert(\"";
        // line 248
        echo getLang("EnterShowFreeShippingMesgOn");
        echo "\");
\t\t\t\t\t\$(\"#ShowFreeShippingMesgOnHomePage\").focus();
\t\t\t\t\treturn false;
\t\t\t\t}
\t\t\t}
\t\t\treturn true;
\t\t}
\t\t\$(document).ready(function() {
\t\t\t\$(\".discountRadio\").live('change', function() {
\t\t\t\tif (\$(this).val() == 'rule_buyxgetfreeshipping'
\t\t\t\t|| \$(this).val() == 'rule_freeshippingwhenoverx') {
\t\t\t\t\t\$(\"#FreeShipingDiscountRulesOptionsSection\").show();
\t\t\t\t} else {
\t\t\t\t\t\$(\"#FreeShipingDiscountRulesOptionsSection\").hide();
\t\t\t\t}
\t\t\t});
\t\t\t\$(\".discountRadio:checked\").trigger(\"change\")

\t\t\t\$('.LearnMoreFreeShippingMessagePlaceHolder').click(function(event){
\t\t\t\tevent.preventDefault();
\t\t\t\tLaunchHelp('907');
\t\t\t});
\t\t});

\t\t";
        // line 272
        echo twig_safe_filter((isset($context['DiscountJavascriptValidation']) ? $context['DiscountJavascriptValidation'] : null));
        echo "
\t</script>
";
    }

}
