<?php

/* @UVDeskAutomation/PreparedResponse/editPreparedResponse.html.twig */
class __TwigTemplate_9db4596f842bb2298886cb5a37fa19164c1ef79036104c4916f89688f9b7ca0b extends Twig_Template
{
    private $source;

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

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

        // line 1
        $this->parent = $this->loadTemplate("@UVDeskCore/Templates/layout.html.twig", "@UVDeskAutomation/PreparedResponse/editPreparedResponse.html.twig", 1);
        $this->blocks = [
            'title' => [$this, 'block_title'],
            'internalcss' => [$this, 'block_internalcss'],
            'pageContent' => [$this, 'block_pageContent'],
            'footer' => [$this, 'block_footer'],
        ];
    }

    protected function doGetParent(array $context)
    {
        return "@UVDeskCore/Templates/layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@UVDeskAutomation/PreparedResponse/editPreparedResponse.html.twig"));

        $this->parent->display($context, array_merge($this->blocks, $blocks));
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 3
    public function block_title($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "title"));

        echo " 
    ";
        // line 4
        if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "get", [0 => "id"], "method")) {
            // line 5
            echo "        ";
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Edit Prepared Response"), "html", null, true);
            echo "
    ";
        } else {
            // line 7
            echo "        ";
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Add Prepared Response"), "html", null, true);
            echo "
    ";
        }
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 11
    public function block_internalcss($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "internalcss"));

        // line 12
        echo "    @media(max-width: 767px) {
        #company-workflow > .steps {
            display: none;
        }
    }

    @media(max-width: 579px) {
        #company-workflow > h3 {
            margin-right: 80px;
        }

        #company-workflow > h3 > a {
            position: absolute;
            top: 0px;
            right: 10px;
        }
    }

    .has-error button.btn {
        border-color: #cc5965;
    }
";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 35
    public function block_pageContent($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "pageContent"));

        // line 36
        echo "    <style>
        .workflow-conditions-body .workflow-condition:first-child .uv-workflow-hr-plank {
            display: none;
        }
    </style>
    <!-- Inner Section -->
    <div class=\"uv-inner-section\">
         ";
        // line 43
        echo twig_include($this->env, $context, "@UVDeskCore/Templates/panel-sidebar.html.twig");
        echo "

        <!-- View -->
        <div class=\"uv-view ";
        // line 46
        if ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "cookies", []) && twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "cookies", []), "get", [0 => "uv-asideView"], "method"))) {
            echo "uv-aside-view";
        }
        echo "\">
            <!-- Form -->
            ";
        // line 48
        if ( !twig_test_empty(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "get", [0 => "id"], "method"))) {
            // line 49
            echo "                <h1>";
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Edit Prepared Response"), "html", null, true);
            echo "</h1>
                <form class=\"workflow-form\" name=\"form-workflow\" method=\"POST\" action=\"";
            // line 50
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("prepare_response_editaction", ["id" => twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "get", [0 => "id"], "method")]), "html", null, true);
            echo "\">
            ";
        } else {
            // line 52
            echo "                <h1>";
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("New Prepared Response"), "html", null, true);
            echo "</h1>
                <form class=\"workflow-form\" name=\"form-workflow\" method=\"POST\" action=\"";
            // line 53
            echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("prepare_response_addaction");
            echo "\">
            ";
        }
        // line 55
        echo "                <!-- Prepared Response Description Section -->
                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">";
        // line 57
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Name"), "html", null, true);
        echo "</label>
                    <div class=\"uv-field-block\">
                        <input name=\"name\" class=\"uv-field\" type=\"text\" value=\"";
        // line 59
        echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "name", [], "any", true, true)) ? (twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "name", [])) : ("")), "html", null, true);
        echo "\">
                        <p class=\"uv-field-message\">";
        // line 60
        if (twig_get_attribute($this->env, $this->source, ($context["error"] ?? null), "name", [], "any", true, true)) {
            echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["error"] ?? null), "name", []), "html", null, true);
        }
        echo "</p>
                    </div>
                </div>

                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">";
        // line 65
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Description"), "html", null, true);
        echo "</label>
                    <div class=\"uv-field-block\">
                        <textarea name=\"description\" class=\"uv-field\">";
        // line 67
        echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "description", [], "any", true, true)) ? (twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "description", [])) : ("")), "html", null, true);
        echo "</textarea>
                        <p class=\"uv-field-message\">";
        // line 68
        if (twig_get_attribute($this->env, $this->source, ($context["error"] ?? null), "description", [], "any", true, true)) {
            echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["error"] ?? null), "description", []), "html", null, true);
        }
        echo "</p>
                    </div>
                </div>

                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">";
        // line 73
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Prepared Response Status"), "html", null, true);
        echo "</label>
                    <div class=\"uv-element-block\">
                        <label>
                            <div class=\"uv-checkbox\">
                                <input name=\"status\" type=\"checkbox\" ";
        // line 77
        echo (((twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "status", [], "any", true, true) && (twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "status", []) == "on"))) ? ("checked") : (""));
        echo ">
                                <span class=\"uv-checkbox-view\"></span>
                            </div>
                            <span class=\"uv-checkbox-label\">";
        // line 80
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Prepared Response is Active"), "html", null, true);
        echo "</span>
                        </label>
                    </div>
                </div>
                ";
        // line 84
        if (twig_get_attribute($this->env, $this->source, ($context["user_service"] ?? null), "isAccessAuthorized", [0 => "ROLE_ADMIN"], "method")) {
            // line 85
            echo "                    <div class=\"uv-hr\"></div>
                
                    <!-- Field -->
                    <div class=\"uv-element-block\">
                        <label class=\"uv-field-label\">";
            // line 89
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Groups"), "html", null, true);
            echo "</label>
                        <div class=\"uv-field-block\" id=\"group-filter\">
                            <input type=\"hidden\" name=\"tempGroups\" class=\"uv-field\" value=\"\" />
                            <input name=\"groups\" class=\"uv-field uv-dropdown-other preloaded\" type=\"text\" id=\"group-filter-input\" value=\"\">
                            <span class=\"uv-field-info\">";
            // line 93
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Share prepared response with user(s) in these group(s)"), "html", null, true);
            echo "</span>
                            <div class=\"uv-dropdown-list uv-bottom-left\">
                                <div class=\"uv-dropdown-container\">
                                    <label>";
            // line 96
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Filter With"), "html", null, true);
            echo "</label>
                                    <ul class=\"\">
                                        ";
            // line 98
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["user_service"] ?? null), "getSupportGroups", [], "method"));
            foreach ($context['_seq'] as $context["_key"] => $context["group"]) {
                // line 99
                echo "                                            <li data-id=\"";
                echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["group"], "id", []), "html", null, true);
                echo "\">
                                                ";
                // line 100
                echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["group"], "name", []), "html", null, true);
                echo "
                                            </li>
                                        ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['group'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 103
            echo "                                        <li class=\"uv-no-results\" style=\"display: none;\">
                                            ";
            // line 104
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("No result found"), "html", null, true);
            echo "
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class=\"uv-filtered-tags\">
                                ";
            // line 110
            if ((twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "groups", [], "any", true, true) && twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "groups", []))) {
                // line 111
                echo "                                    ";
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "groups", []));
                foreach ($context['_seq'] as $context["_key"] => $context["group"]) {
                    // line 112
                    echo "                                        ";
                    if (twig_get_attribute($this->env, $this->source, $context["group"], "isActive", [])) {
                        // line 113
                        echo "                                            <a class=\"uv-btn-small default\" href=\"#\" data-id=\"";
                        echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["group"], "id", []), "html", null, true);
                        echo "\">
                                                ";
                        // line 114
                        echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["group"], "name", []), "html", null, true);
                        echo "
                                                <span class=\"uv-icon-remove\"></span>
                                            </a>
                                        ";
                    }
                    // line 118
                    echo "                                    ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['group'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 119
                echo "                                ";
            }
            // line 120
            echo "                            </div>
                        </div>
                    </div>
                    <!-- //Field -->

                    <!-- Field -->
                    <div class=\"uv-element-block\">
                        <label class=\"uv-field-label\">";
            // line 127
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Teams"), "html", null, true);
            echo "</label>
                        <div class=\"uv-field-block\" id=\"team-filter\">
                            <input type=\"hidden\" name=\"tempTeams\" class=\"uv-field\" value=\"\" />
                            <input class=\"uv-field uv-dropdown-other preloaded\" type=\"text\" id=\"team-filter-input\">
                            <span class=\"uv-field-info\">";
            // line 131
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Share prepared response with user(s) in these teams(s)"), "html", null, true);
            echo "</span>
                            <div class=\"uv-dropdown-list uv-bottom-left\">
                                <div class=\"uv-dropdown-container\">
                                    <label>";
            // line 134
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Filter With"), "html", null, true);
            echo "</label>
                                    <ul class=\"\">
                                        ";
            // line 136
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["user_service"] ?? null), "getSupportTeams", [], "method"));
            foreach ($context['_seq'] as $context["_key"] => $context["team"]) {
                // line 137
                echo "                                            <li data-id=\"";
                echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["team"], "id", []), "html", null, true);
                echo "\">
                                                ";
                // line 138
                echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["team"], "name", []), "html", null, true);
                echo "
                                            </li>
                                        ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['team'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 141
            echo "                                        <li class=\"uv-no-results\" style=\"display: none;\">
                                            ";
            // line 142
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("No result found"), "html", null, true);
            echo "
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class=\"uv-filtered-tags\">
                                ";
            // line 148
            if ((twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "teams", [], "any", true, true) && twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "teams", []))) {
                // line 149
                echo "                                    ";
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["formData"] ?? null), "teams", []));
                foreach ($context['_seq'] as $context["_key"] => $context["team"]) {
                    // line 150
                    echo "                                        ";
                    if (twig_get_attribute($this->env, $this->source, $context["team"], "isActive", [])) {
                        // line 151
                        echo "                                            <a class=\"uv-btn-small default\" href=\"#\" data-id=\"";
                        echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["team"], "id", []), "html", null, true);
                        echo "\">
                                                ";
                        // line 152
                        echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["team"], "name", []), "html", null, true);
                        echo "
                                                <span class=\"uv-icon-remove\"></span>
                                            </a>
                                        ";
                    }
                    // line 156
                    echo "                                    ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['team'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 157
                echo "                                ";
            }
            // line 158
            echo "                            </div>
                        </div>
                    </div>
                    <!-- //Field --> 
                ";
        }
        // line 163
        echo "                <div class=\"uv-hr\"></div>
                <!-- // Prepared Response Description Section -->


                <!-- Prepared Response Actions Section -->
                <div id=\"actions\" class=\"uv-element-block uv-field-workflow\">
                    <label class=\"uv-field-label\">";
        // line 169
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Actions"), "html", null, true);
        echo "</label>
                    <span class=\"uv-field-info\">";
        // line 170
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("An action not only reduces the workload but also makes it quite easier for ticket automation"), "html", null, true);
        echo "</span>

                    <div class=\"workflow-action-body\"></div>
                    <div class=\"uv-workflow-buttons\">
                        <a class=\"uv-btn-tag btn-add\" href=\"#\">
                            <span class=\"uv-icon-add-dark\"></span> ";
        // line 175
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Add More"), "html", null, true);
        echo "
                        </a>
                    </div>
                </div>
                <!-- // Prepared Response Actions Section -->


                <!-- CTA -->
                ";
        // line 184
        echo "                <button type=\"submit\" name=\"submit\" class=\"uv-btn\" href=\"#\" ";
        if (((isset($context["forcedActions"]) || array_key_exists("forcedActions", $context)) && ($context["forcedActions"] ?? null))) {
            echo "disabled=\"disabled\" date-toggle=\"tooltip\" title=\"";
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("You don't have premission to edit this Prepared response"), "html", null, true);
            echo " \" ";
        }
        echo " >";
        if ( !twig_test_empty(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", []), "get", [0 => "id"], "method"))) {
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Save Prepared Response"), "html", null, true);
        } else {
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Add Prepared Response"), "html", null, true);
        }
        echo "</button>
                <!-- // CTA -->
            </form>
            <!-- Form -->
        </div>
        <!-- // View -->
    </div>
    <!-- // Inner Section -->
";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 194
    public function block_footer($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "footer"));

        // line 195
        echo "    ";
        $this->displayParentBlock("footer", $context, $blocks);
        echo "

    <script type=\"text/javascript\">
        _.extend(Backbone.Validation.patterns, {
          stringPattern: /[a-z0-9]/i,
        });

        _.extend(Backbone.Validation.callbacks, {
            valid : function (view, attr, selector) {
                console.log(\$('[name=\"'+attr+'\"]').closest('.uv-field-block'));
                \$('[name=\"'+attr+'\"]').closest('.uv-field-block').find('.uv-field-message').html('').fadeOut(0);
            },
            invalid : function (view, attr, error, selector) {
                console.log(\$('[name=\"'+attr+'\"]').closest('.uv-field-block'));
                \$('[name=\"'+attr+'\"]').closest('.uv-field-block').find('.uv-field-message').html(error).fadeIn(0);
            }
        });

        if(typeof(sB) == 'undefined'){
          var sB = {};
        }

        sB.WorkflowCollection = Backbone.Collection.extend({
            baseUrl: \"";
        // line 218
        echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("ajax_service_call");
        echo "\",
            fetchResult: function(dataMatch) {
            this.url = this.baseUrl;
            return this.fetch({ 'data' : {
                'service': 'email.service',
                'call': 'getEmailPlaceHolders',
                'options': { 'match': dataMatch },
            }});
        }});
        sB.workflowCollection = new sB.WorkflowCollection();

        sB.WorkflowModel = Backbone.Model.extend({
            validation: {
                name: {
                    required: true,
                    pattern: 'stringPattern',
                    msg: \"";
        // line 234
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Please enter a valid name."), "html", null, true);
        echo "\"
                },
            },
\t\t\t";
        // line 237
        if ( !((isset($context["forcedActions"]) || array_key_exists("forcedActions", $context)) && ($context["forcedActions"] ?? null))) {
            // line 238
            echo "                validateSelect: function(value, attr, computedState) {
                    var currentSelectValue = \$('select[name=\"'+ attr + '\"]').prev().find('.selected').length;
                    if (!value) {
                        return \"";
            // line 241
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Please select a value."), "html", null, true);
            echo "\";
                    }
                },
                validateSelectMultiple: function(value, attr, computedState) {
                    var currentSelectValue = \$('[name=\"'+ attr + '\"]').length;
                    if (!value) {
                        return \"";
            // line 247
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Please select a value."), "html", null, true);
            echo "\";
                    }
                },
                validateSelectText: function(value, attr, computedState) {
                    if (!value) {
                        return \"";
            // line 252
            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Please add a value."), "html", null, true);
            echo "\";
                    }
                }
\t\t\t";
        }
        // line 255
        echo "            
        });

        sB.WorkflowView = Backbone.View.extend({
            el: '.uv-view',
            initialize: function() {
                this.model = new sB.WorkflowModel();
                Backbone.Validation.bind(this);
                this.setAddedIds('#group-filter');
                this.setAddedIds('#team-filter');
            },
            events: {
                'submit form[name=\"form-workflow\"]': 'processWorlfow',
                'click .workflow-form .uv-dropdown-list li': 'addEntity',
                'click .workflow-form .uv-filtered-tags .uv-btn-small': 'removeEntity'                
            },
            processWorlfow: function(e) {
                this.model.set(this.\$el.find('form').serializeObject());

                var self = this;
                filterArray = ['name'];
                // Populate Filter Array - Events and Actions are required fields
                
                // Actions
                this.\$('.wfAction').each(function(key, value) {
                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelect';
                });
                this.\$('.wfActionMultiple').each(function(key, value) {
                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelectMultiple';
                });
                this.\$('.wfActionValue').each(function(key, value) {
                    if (\$(this).attr('name') == undefined) {
                        return;
                    }

                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelectText';
                });

                if (this.validateData(filterArray)) {
                    return true;
                } else {
                    e.preventDefault();
                }
            },
            validateData: function(filterArray) {
                return this.model.isValid(filterArray);
            },
            updateActive: function(e){
                this.\$('div.step-info').each(function() {
                    \$(this).addClass('active');
                    if (\$(this).attr('data-href') == self.\$(e.target).attr('href'))
                        return false;
                });
            },
            addEntity: function(e) {
                currentElement = Backbone.\$(e.currentTarget);
                if(id = currentElement.attr(\"data-id\")) {
                    parent = currentElement.parents(\".uv-field-block\");
                    parent.find('input').val('')
                    parent.find(\"li:not(.uv-no-results)\").show();

                    if(!parent.find(\".uv-filtered-tags a[data-id='\" + id + \"']\").length) {
                        parent.find('.uv-filtered-tags').append(\"<a class='uv-btn-small default' href='#' data-id='\" + id + \"'>\"+currentElement.text()+\"<span class='uv-icon-remove'></span></a>\")
                        this.setAddedIds(\"#\" + parent.attr('id'))
                    }
                }
            },
            removeEntity: function(e) {
                var parent = Backbone.\$(e.currentTarget).parents(\".uv-field-block\")
                Backbone.\$(e.currentTarget).remove()
                this.setAddedIds(\"#\" + parent.attr('id'))
            },
            setAddedIds: function(selector) {
                var ids = [];
                \$(selector).find('.uv-filtered-tags .uv-btn-small').each(function() {
                    ids.push(\$(this).attr('data-id'))
                });

                \$(selector).find(\"input[type='hidden']\").val(ids.join(','))

                return ids;
            },            
        });
        sB.workflowView = new sB.WorkflowView();

        \$.fn.serializeObject = function () {
            \"use strict\";
            var a = {}, b = function (b, c) {
                var d = a[c.name];
                \"undefined\" != typeof d && d !== null ? \$.isArray(d) ? d.push(c.value) : a[c.name] = [d, c.value] : a[c.name] = c.value
            };
            return \$.each(this.serializeArray(), b), a
        };
    </script>
    
    ";
        // line 353
        echo twig_include($this->env, $context, "@UVDeskAutomation//PreparedResponse//actions.html.twig");
        echo "
";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    public function getTemplateName()
    {
        return "@UVDeskAutomation/PreparedResponse/editPreparedResponse.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  643 => 353,  543 => 255,  536 => 252,  528 => 247,  519 => 241,  514 => 238,  512 => 237,  506 => 234,  487 => 218,  460 => 195,  454 => 194,  427 => 184,  416 => 175,  408 => 170,  404 => 169,  396 => 163,  389 => 158,  386 => 157,  380 => 156,  373 => 152,  368 => 151,  365 => 150,  360 => 149,  358 => 148,  349 => 142,  346 => 141,  337 => 138,  332 => 137,  328 => 136,  323 => 134,  317 => 131,  310 => 127,  301 => 120,  298 => 119,  292 => 118,  285 => 114,  280 => 113,  277 => 112,  272 => 111,  270 => 110,  261 => 104,  258 => 103,  249 => 100,  244 => 99,  240 => 98,  235 => 96,  229 => 93,  222 => 89,  216 => 85,  214 => 84,  207 => 80,  201 => 77,  194 => 73,  184 => 68,  180 => 67,  175 => 65,  165 => 60,  161 => 59,  156 => 57,  152 => 55,  147 => 53,  142 => 52,  137 => 50,  132 => 49,  130 => 48,  123 => 46,  117 => 43,  108 => 36,  102 => 35,  74 => 12,  68 => 11,  57 => 7,  51 => 5,  49 => 4,  41 => 3,  15 => 1,);
    }

    public function getSourceContext()
    {
        return new Twig_Source("{% extends \"@UVDeskCore/Templates/layout.html.twig\" %}

{% block title %} 
    {% if app.request.get('id') %}
        {{ 'Edit Prepared Response' | trans }}
    {% else %}
        {{ 'Add Prepared Response' | trans }}
    {% endif %}
{% endblock %}

{% block internalcss %}
    @media(max-width: 767px) {
        #company-workflow > .steps {
            display: none;
        }
    }

    @media(max-width: 579px) {
        #company-workflow > h3 {
            margin-right: 80px;
        }

        #company-workflow > h3 > a {
            position: absolute;
            top: 0px;
            right: 10px;
        }
    }

    .has-error button.btn {
        border-color: #cc5965;
    }
{% endblock %}

{% block pageContent %}
    <style>
        .workflow-conditions-body .workflow-condition:first-child .uv-workflow-hr-plank {
            display: none;
        }
    </style>
    <!-- Inner Section -->
    <div class=\"uv-inner-section\">
         {{ include('@UVDeskCore/Templates/panel-sidebar.html.twig') }}

        <!-- View -->
        <div class=\"uv-view {% if app.request.cookies and app.request.cookies.get('uv-asideView') %}uv-aside-view{% endif %}\">
            <!-- Form -->
            {% if app.request.get('id') is not empty %}
                <h1>{{ 'Edit Prepared Response'|trans }}</h1>
                <form class=\"workflow-form\" name=\"form-workflow\" method=\"POST\" action=\"{{ path('prepare_response_editaction', {'id': app.request.get('id')}) }}\">
            {% else %}
                <h1>{{ 'New Prepared Response'|trans }}</h1>
                <form class=\"workflow-form\" name=\"form-workflow\" method=\"POST\" action=\"{{ path('prepare_response_addaction') }}\">
            {% endif %}
                <!-- Prepared Response Description Section -->
                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">{{ 'Name'|trans }}</label>
                    <div class=\"uv-field-block\">
                        <input name=\"name\" class=\"uv-field\" type=\"text\" value=\"{{ formData.name is defined ? formData.name : '' }}\">
                        <p class=\"uv-field-message\">{% if error.name is defined %}{{ error.name }}{% endif %}</p>
                    </div>
                </div>

                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">{{ 'Description'|trans }}</label>
                    <div class=\"uv-field-block\">
                        <textarea name=\"description\" class=\"uv-field\">{{ formData.description is defined ? formData.description : '' }}</textarea>
                        <p class=\"uv-field-message\">{% if error.description is defined %}{{ error.description }}{% endif %}</p>
                    </div>
                </div>

                <div class=\"uv-element-block\">
                    <label class=\"uv-field-label\">{{ 'Prepared Response Status'|trans }}</label>
                    <div class=\"uv-element-block\">
                        <label>
                            <div class=\"uv-checkbox\">
                                <input name=\"status\" type=\"checkbox\" {{ formData.status is defined and formData.status == 'on' ? 'checked' : '' }}>
                                <span class=\"uv-checkbox-view\"></span>
                            </div>
                            <span class=\"uv-checkbox-label\">{{ 'Prepared Response is Active'|trans }}</span>
                        </label>
                    </div>
                </div>
                {% if user_service.isAccessAuthorized('ROLE_ADMIN') %}
                    <div class=\"uv-hr\"></div>
                
                    <!-- Field -->
                    <div class=\"uv-element-block\">
                        <label class=\"uv-field-label\">{{ 'Groups'|trans }}</label>
                        <div class=\"uv-field-block\" id=\"group-filter\">
                            <input type=\"hidden\" name=\"tempGroups\" class=\"uv-field\" value=\"\" />
                            <input name=\"groups\" class=\"uv-field uv-dropdown-other preloaded\" type=\"text\" id=\"group-filter-input\" value=\"\">
                            <span class=\"uv-field-info\">{{ 'Share prepared response with user(s) in these group(s)'|trans }}</span>
                            <div class=\"uv-dropdown-list uv-bottom-left\">
                                <div class=\"uv-dropdown-container\">
                                    <label>{{ 'Filter With'|trans }}</label>
                                    <ul class=\"\">
                                        {% for group in user_service.getSupportGroups() %}
                                            <li data-id=\"{{group.id}}\">
                                                {{group.name}}
                                            </li>
                                        {% endfor %}
                                        <li class=\"uv-no-results\" style=\"display: none;\">
                                            {{ 'No result found'|trans }}
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class=\"uv-filtered-tags\">
                                {% if formData.groups is defined and formData.groups %}
                                    {% for group in formData.groups %}
                                        {% if group.isActive %}
                                            <a class=\"uv-btn-small default\" href=\"#\" data-id=\"{{group.id }}\">
                                                {{ group.name }}
                                                <span class=\"uv-icon-remove\"></span>
                                            </a>
                                        {% endif %}
                                    {% endfor %}
                                {% endif %}
                            </div>
                        </div>
                    </div>
                    <!-- //Field -->

                    <!-- Field -->
                    <div class=\"uv-element-block\">
                        <label class=\"uv-field-label\">{{ 'Teams'|trans }}</label>
                        <div class=\"uv-field-block\" id=\"team-filter\">
                            <input type=\"hidden\" name=\"tempTeams\" class=\"uv-field\" value=\"\" />
                            <input class=\"uv-field uv-dropdown-other preloaded\" type=\"text\" id=\"team-filter-input\">
                            <span class=\"uv-field-info\">{{ 'Share prepared response with user(s) in these teams(s)'|trans }}</span>
                            <div class=\"uv-dropdown-list uv-bottom-left\">
                                <div class=\"uv-dropdown-container\">
                                    <label>{{ 'Filter With'|trans }}</label>
                                    <ul class=\"\">
                                        {% for team in user_service.getSupportTeams() %}
                                            <li data-id=\"{{team.id}}\">
                                                {{team.name}}
                                            </li>
                                        {% endfor %}
                                        <li class=\"uv-no-results\" style=\"display: none;\">
                                            {{ 'No result found'|trans }}
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class=\"uv-filtered-tags\">
                                {% if formData.teams is defined and formData.teams %}
                                    {% for team in formData.teams %}
                                        {% if team.isActive %}
                                            <a class=\"uv-btn-small default\" href=\"#\" data-id=\"{{team.id }}\">
                                                {{ team.name }}
                                                <span class=\"uv-icon-remove\"></span>
                                            </a>
                                        {% endif %}
                                    {% endfor %}
                                {% endif %}
                            </div>
                        </div>
                    </div>
                    <!-- //Field --> 
                {% endif %}
                <div class=\"uv-hr\"></div>
                <!-- // Prepared Response Description Section -->


                <!-- Prepared Response Actions Section -->
                <div id=\"actions\" class=\"uv-element-block uv-field-workflow\">
                    <label class=\"uv-field-label\">{{ 'Actions'|trans }}</label>
                    <span class=\"uv-field-info\">{{ 'An action not only reduces the workload but also makes it quite easier for ticket automation'|trans }}</span>

                    <div class=\"workflow-action-body\"></div>
                    <div class=\"uv-workflow-buttons\">
                        <a class=\"uv-btn-tag btn-add\" href=\"#\">
                            <span class=\"uv-icon-add-dark\"></span> {{ 'Add More'|trans }}
                        </a>
                    </div>
                </div>
                <!-- // Prepared Response Actions Section -->


                <!-- CTA -->
                {# <input type=\"submit\" class=\"uv-btn\" href=\"#\" value=\"Save Prepared Response\"> #}
                <button type=\"submit\" name=\"submit\" class=\"uv-btn\" href=\"#\" {% if forcedActions is defined and forcedActions %}disabled=\"disabled\" date-toggle=\"tooltip\" title=\"{{ \"You don't have premission to edit this Prepared response\"|trans }} \" {% endif %} >{% if app.request.get('id') is not empty %}{{ 'Save Prepared Response'|trans }}{% else %}{{ 'Add Prepared Response'|trans }}{% endif %}</button>
                <!-- // CTA -->
            </form>
            <!-- Form -->
        </div>
        <!-- // View -->
    </div>
    <!-- // Inner Section -->
{% endblock %}

{% block footer %}
    {{ parent() }}

    <script type=\"text/javascript\">
        _.extend(Backbone.Validation.patterns, {
          stringPattern: /[a-z0-9]/i,
        });

        _.extend(Backbone.Validation.callbacks, {
            valid : function (view, attr, selector) {
                console.log(\$('[name=\"'+attr+'\"]').closest('.uv-field-block'));
                \$('[name=\"'+attr+'\"]').closest('.uv-field-block').find('.uv-field-message').html('').fadeOut(0);
            },
            invalid : function (view, attr, error, selector) {
                console.log(\$('[name=\"'+attr+'\"]').closest('.uv-field-block'));
                \$('[name=\"'+attr+'\"]').closest('.uv-field-block').find('.uv-field-message').html(error).fadeIn(0);
            }
        });

        if(typeof(sB) == 'undefined'){
          var sB = {};
        }

        sB.WorkflowCollection = Backbone.Collection.extend({
            baseUrl: \"{{ path('ajax_service_call') }}\",
            fetchResult: function(dataMatch) {
            this.url = this.baseUrl;
            return this.fetch({ 'data' : {
                'service': 'email.service',
                'call': 'getEmailPlaceHolders',
                'options': { 'match': dataMatch },
            }});
        }});
        sB.workflowCollection = new sB.WorkflowCollection();

        sB.WorkflowModel = Backbone.Model.extend({
            validation: {
                name: {
                    required: true,
                    pattern: 'stringPattern',
                    msg: \"{{ 'Please enter a valid name.'|trans }}\"
                },
            },
\t\t\t{% if not(forcedActions is defined and forcedActions) %}
                validateSelect: function(value, attr, computedState) {
                    var currentSelectValue = \$('select[name=\"'+ attr + '\"]').prev().find('.selected').length;
                    if (!value) {
                        return \"{{ 'Please select a value.'|trans }}\";
                    }
                },
                validateSelectMultiple: function(value, attr, computedState) {
                    var currentSelectValue = \$('[name=\"'+ attr + '\"]').length;
                    if (!value) {
                        return \"{{ 'Please select a value.'|trans }}\";
                    }
                },
                validateSelectText: function(value, attr, computedState) {
                    if (!value) {
                        return \"{{ 'Please add a value.'|trans }}\";
                    }
                }
\t\t\t{% endif %}            
        });

        sB.WorkflowView = Backbone.View.extend({
            el: '.uv-view',
            initialize: function() {
                this.model = new sB.WorkflowModel();
                Backbone.Validation.bind(this);
                this.setAddedIds('#group-filter');
                this.setAddedIds('#team-filter');
            },
            events: {
                'submit form[name=\"form-workflow\"]': 'processWorlfow',
                'click .workflow-form .uv-dropdown-list li': 'addEntity',
                'click .workflow-form .uv-filtered-tags .uv-btn-small': 'removeEntity'                
            },
            processWorlfow: function(e) {
                this.model.set(this.\$el.find('form').serializeObject());

                var self = this;
                filterArray = ['name'];
                // Populate Filter Array - Events and Actions are required fields
                
                // Actions
                this.\$('.wfAction').each(function(key, value) {
                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelect';
                });
                this.\$('.wfActionMultiple').each(function(key, value) {
                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelectMultiple';
                });
                this.\$('.wfActionValue').each(function(key, value) {
                    if (\$(this).attr('name') == undefined) {
                        return;
                    }

                    filterArray.push(\$(value).attr('name'));
                    self.model.validation[\$(value).attr('name')] = 'validateSelectText';
                });

                if (this.validateData(filterArray)) {
                    return true;
                } else {
                    e.preventDefault();
                }
            },
            validateData: function(filterArray) {
                return this.model.isValid(filterArray);
            },
            updateActive: function(e){
                this.\$('div.step-info').each(function() {
                    \$(this).addClass('active');
                    if (\$(this).attr('data-href') == self.\$(e.target).attr('href'))
                        return false;
                });
            },
            addEntity: function(e) {
                currentElement = Backbone.\$(e.currentTarget);
                if(id = currentElement.attr(\"data-id\")) {
                    parent = currentElement.parents(\".uv-field-block\");
                    parent.find('input').val('')
                    parent.find(\"li:not(.uv-no-results)\").show();

                    if(!parent.find(\".uv-filtered-tags a[data-id='\" + id + \"']\").length) {
                        parent.find('.uv-filtered-tags').append(\"<a class='uv-btn-small default' href='#' data-id='\" + id + \"'>\"+currentElement.text()+\"<span class='uv-icon-remove'></span></a>\")
                        this.setAddedIds(\"#\" + parent.attr('id'))
                    }
                }
            },
            removeEntity: function(e) {
                var parent = Backbone.\$(e.currentTarget).parents(\".uv-field-block\")
                Backbone.\$(e.currentTarget).remove()
                this.setAddedIds(\"#\" + parent.attr('id'))
            },
            setAddedIds: function(selector) {
                var ids = [];
                \$(selector).find('.uv-filtered-tags .uv-btn-small').each(function() {
                    ids.push(\$(this).attr('data-id'))
                });

                \$(selector).find(\"input[type='hidden']\").val(ids.join(','))

                return ids;
            },            
        });
        sB.workflowView = new sB.WorkflowView();

        \$.fn.serializeObject = function () {
            \"use strict\";
            var a = {}, b = function (b, c) {
                var d = a[c.name];
                \"undefined\" != typeof d && d !== null ? \$.isArray(d) ? d.push(c.value) : a[c.name] = [d, c.value] : a[c.name] = c.value
            };
            return \$.each(this.serializeArray(), b), a
        };
    </script>
    
    {{ include('@UVDeskAutomation//PreparedResponse//actions.html.twig') }}
{% endblock %}", "@UVDeskAutomation/PreparedResponse/editPreparedResponse.html.twig", "/home/users/akshay.kumar/Workstation/apps/uvdesk/releases/uvdesk_community_01_development_php_72/vendor/uvdesk/automation-bundle/Resources/views/PreparedResponse/editPreparedResponse.html.twig");
    }
}
