<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
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;
use Twig\TemplateWrapper;

/* extension/journal_3/catalog/view/template/product/review.twig */
class __TwigTemplate_5c1541d169b647a3346332d4ee7443e1 extends Template
{
    private Source $source;
    /**
     * @var array<string, Template>
     */
    private array $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 = []): iterable
    {
        $macros = $this->macros;
        // line 1
        yield "<form class=\"form-horizontal\" id=\"form-review\">
  <div id=\"review\">";
        // line 2
        yield ($context["list"] ?? null);
        yield "</div>
  <h4>";
        // line 3
        yield ($context["text_write"] ?? null);
        yield "</h4>
  ";
        // line 4
        if (($context["review_guest"] ?? null)) {
            // line 5
            yield "    ";
            if (($context["entry_name"] ?? null)) {
                // line 6
                yield "    <div class=\"form-group mb-3 required\">
      <label for=\"input-name\" class=\"form-label control-label\">";
                // line 7
                yield ($context["entry_name"] ?? null);
                yield "</label>
      <input type=\"text\" name=\"name\" value=\"";
                // line 8
                yield ($context["customer_name"] ?? null);
                yield "\" id=\"input-name\" class=\"form-control\"/>
      <div id=\"error-name\" class=\"invalid-feedback\"></div>
    </div>
    ";
            } else {
                // line 12
                yield "    <div class=\"form-group mb-3 required\">
      <label for=\"input-author\" class=\"form-label control-label\">";
                // line 13
                yield ($context["entry_author"] ?? null);
                yield "</label>
      <input type=\"text\" name=\"author\" value=\"";
                // line 14
                yield ($context["customer"] ?? null);
                yield "\" id=\"input-author\" class=\"form-control\"/>
      <div id=\"error-author\" class=\"invalid-feedback\"></div>
    </div>
    ";
            }
            // line 18
            yield "    <div class=\"form-group mb-3 required\">
      <label for=\"input-text\" class=\"form-label control-label\">";
            // line 19
            yield ($context["entry_review"] ?? null);
            yield "</label>
      <textarea name=\"text\" rows=\"5\" id=\"input-text\" class=\"form-control\"></textarea>
      <div id=\"error-text\" class=\"invalid-feedback\"></div>
      <div class=\"invalid-feedback\">";
            // line 22
            yield ($context["text_note"] ?? null);
            yield "</div>
    </div>
    <div class=\"form-group row mb-3 required\">
      <label class=\"form-label control-label\">";
            // line 25
            yield ($context["entry_rating"] ?? null);
            yield "</label>
      <div id=\"input-rating\" class=\"rate\">
        ";
            // line 27
            yield ($context["entry_bad"] ?? null);
            yield "&nbsp;
        <input type=\"radio\" name=\"rating\" value=\"1\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"2\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"3\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"4\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"5\" class=\"form-check-input\"/>
        &nbsp;";
            // line 37
            yield ($context["entry_good"] ?? null);
            yield "
      </div>
      <div id=\"error-rating\" class=\"invalid-feedback\"></div>
    </div>
    ";
            // line 41
            yield ($context["captcha"] ?? null);
            yield "
    <div class=\"d-inline-block pt-2 pd-2 w-100 buttons\">
      <div class=\"float-end\">
        <button type=\"submit\" id=\"button-review\" class=\"btn btn-primary\">";
            // line 44
            yield ($context["button_continue"] ?? null);
            yield "</button>
      </div>
    </div>
  ";
        } else {
            // line 48
            yield "    ";
            yield ($context["text_login"] ?? null);
            yield "
  ";
        }
        // line 50
        yield "</form>
<script type=\"text/javascript\"><!--
\$('#review').on('click', '.pagination a', function (e) {
    e.preventDefault();

    \$('#review').load(this.href);
});

// Forms
\$('#form-review').on('submit', function (e) {
    e.preventDefault();

    var element = this;

    \$.ajax({
        url: 'index.php?route=product/review";
        // line 65
        yield Twig\Extension\CoreExtension::constant("JOURNAL3_ROUTE_SEPARATOR");
        yield "write&language=";
        yield ($context["language"] ?? null);
        yield "&review_token=__REVIEW_TOKEN__&product_id=";
        yield ($context["product_id"] ?? null);
        yield "',
        type: 'post',
        data: \$('#form-review').serialize(),
        dataType: 'json',
        cache: false,
        contentType: 'application/x-www-form-urlencoded',
        processData: false,
        beforeSend: function () {
            \$('#button-review').prop('disabled', true).addClass('loading');
        },
        complete: function () {
            \$('#button-review').prop('disabled', false).removeClass('loading');
        },
        success: function (json) {
            \$('.alert-dismissible').remove();
            \$('#form-review').find('.is-invalid').removeClass('is-invalid');
            \$('#form-review').find('.has-error').removeClass('has-error');
            \$('#form-review').find('.invalid-feedback').removeClass('d-block');

            if (json['error']) {
              if (json['error']['warning']) {
                  \$('#form-review').prepend('<div class=\"alert alert-danger alert-dismissible\"><i class=\"fa-solid fa-circle-exclamation\"></i> ' + json['error']['warning'] + ' <button type=\"button\" class=\"btn-close close\" data-bs-dismiss=\"alert\"></button></div>');
              }

              for (key in json['error']) {
                  \$('#input-' + key.replaceAll('_', '-')).addClass('is-invalid').find('.form-control, .form-select, .form-check-input, .form-check-label').addClass('is-invalid');
                  \$('#input-' + key.replaceAll('_', '-')).closest('.form-group').addClass('has-error');
                  \$('#error-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
              }
            }

            if (json['success']) {
                \$('#form-review').prepend('<div class=\"alert alert-success alert-dismissible\"><i class=\"fa-solid fa-circle-exclamation\"></i> ' + json['success'] + ' <button type=\"button\" class=\"btn-close close\" data-bs-dismiss=\"alert\"></button></div>');

                \$('#input-text').val('');
                \$('#input-rating input[type=\\'radio\\']').prop('checked', false);
            }
        },
        error: function (xhr, ajaxOptions, thrownError) {
            console.log(thrownError + \"\\r\\n\" + xhr.statusText + \"\\r\\n\" + xhr.responseText);
        }
    });
});
//--></script>
";
        yield from [];
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName(): string
    {
        return "extension/journal_3/catalog/view/template/product/review.twig";
    }

    /**
     * @codeCoverageIgnore
     */
    public function isTraitable(): bool
    {
        return false;
    }

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  162 => 65,  145 => 50,  139 => 48,  132 => 44,  126 => 41,  119 => 37,  106 => 27,  101 => 25,  95 => 22,  89 => 19,  86 => 18,  79 => 14,  75 => 13,  72 => 12,  65 => 8,  61 => 7,  58 => 6,  55 => 5,  53 => 4,  49 => 3,  45 => 2,  42 => 1,);
    }

    public function getSourceContext(): Source
    {
        return new Source("<form class=\"form-horizontal\" id=\"form-review\">
  <div id=\"review\">{{ list }}</div>
  <h4>{{ text_write }}</h4>
  {% if review_guest %}
    {% if entry_name %}
    <div class=\"form-group mb-3 required\">
      <label for=\"input-name\" class=\"form-label control-label\">{{ entry_name }}</label>
      <input type=\"text\" name=\"name\" value=\"{{ customer_name }}\" id=\"input-name\" class=\"form-control\"/>
      <div id=\"error-name\" class=\"invalid-feedback\"></div>
    </div>
    {% else %}
    <div class=\"form-group mb-3 required\">
      <label for=\"input-author\" class=\"form-label control-label\">{{ entry_author }}</label>
      <input type=\"text\" name=\"author\" value=\"{{ customer }}\" id=\"input-author\" class=\"form-control\"/>
      <div id=\"error-author\" class=\"invalid-feedback\"></div>
    </div>
    {% endif %}
    <div class=\"form-group mb-3 required\">
      <label for=\"input-text\" class=\"form-label control-label\">{{ entry_review }}</label>
      <textarea name=\"text\" rows=\"5\" id=\"input-text\" class=\"form-control\"></textarea>
      <div id=\"error-text\" class=\"invalid-feedback\"></div>
      <div class=\"invalid-feedback\">{{ text_note }}</div>
    </div>
    <div class=\"form-group row mb-3 required\">
      <label class=\"form-label control-label\">{{ entry_rating }}</label>
      <div id=\"input-rating\" class=\"rate\">
        {{ entry_bad }}&nbsp;
        <input type=\"radio\" name=\"rating\" value=\"1\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"2\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"3\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"4\" class=\"form-check-input\"/>
        &nbsp;
        <input type=\"radio\" name=\"rating\" value=\"5\" class=\"form-check-input\"/>
        &nbsp;{{ entry_good }}
      </div>
      <div id=\"error-rating\" class=\"invalid-feedback\"></div>
    </div>
    {{ captcha }}
    <div class=\"d-inline-block pt-2 pd-2 w-100 buttons\">
      <div class=\"float-end\">
        <button type=\"submit\" id=\"button-review\" class=\"btn btn-primary\">{{ button_continue }}</button>
      </div>
    </div>
  {% else %}
    {{ text_login }}
  {% endif %}
</form>
<script type=\"text/javascript\"><!--
\$('#review').on('click', '.pagination a', function (e) {
    e.preventDefault();

    \$('#review').load(this.href);
});

// Forms
\$('#form-review').on('submit', function (e) {
    e.preventDefault();

    var element = this;

    \$.ajax({
        url: 'index.php?route=product/review{{ constant('JOURNAL3_ROUTE_SEPARATOR') }}write&language={{ language }}&review_token=__REVIEW_TOKEN__&product_id={{ product_id }}',
        type: 'post',
        data: \$('#form-review').serialize(),
        dataType: 'json',
        cache: false,
        contentType: 'application/x-www-form-urlencoded',
        processData: false,
        beforeSend: function () {
            \$('#button-review').prop('disabled', true).addClass('loading');
        },
        complete: function () {
            \$('#button-review').prop('disabled', false).removeClass('loading');
        },
        success: function (json) {
            \$('.alert-dismissible').remove();
            \$('#form-review').find('.is-invalid').removeClass('is-invalid');
            \$('#form-review').find('.has-error').removeClass('has-error');
            \$('#form-review').find('.invalid-feedback').removeClass('d-block');

            if (json['error']) {
              if (json['error']['warning']) {
                  \$('#form-review').prepend('<div class=\"alert alert-danger alert-dismissible\"><i class=\"fa-solid fa-circle-exclamation\"></i> ' + json['error']['warning'] + ' <button type=\"button\" class=\"btn-close close\" data-bs-dismiss=\"alert\"></button></div>');
              }

              for (key in json['error']) {
                  \$('#input-' + key.replaceAll('_', '-')).addClass('is-invalid').find('.form-control, .form-select, .form-check-input, .form-check-label').addClass('is-invalid');
                  \$('#input-' + key.replaceAll('_', '-')).closest('.form-group').addClass('has-error');
                  \$('#error-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
              }
            }

            if (json['success']) {
                \$('#form-review').prepend('<div class=\"alert alert-success alert-dismissible\"><i class=\"fa-solid fa-circle-exclamation\"></i> ' + json['success'] + ' <button type=\"button\" class=\"btn-close close\" data-bs-dismiss=\"alert\"></button></div>');

                \$('#input-text').val('');
                \$('#input-rating input[type=\\'radio\\']').prop('checked', false);
            }
        },
        error: function (xhr, ajaxOptions, thrownError) {
            console.log(thrownError + \"\\r\\n\" + xhr.statusText + \"\\r\\n\" + xhr.responseText);
        }
    });
});
//--></script>
", "extension/journal_3/catalog/view/template/product/review.twig", "/home/isatuzun/public_html/opencart.my-multiplanet.ch/extension/journal_3/catalog/view/template/product/review.twig");
    }
}
