<?php

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

/* @App/help/helpassistance/list_help.html.twig */
class __TwigTemplate_962f05e01c11d65133075c71f46bd951e9adc6c1fb0a4a7d85abe844a88438b3 extends \Twig\Template
{
    public function __construct(Environment $env)
    {
        parent::__construct($env);

        // line 1
        $this->parent = $this->loadTemplate("@App/Layouts/layout.html.twig", "@App/help/helpassistance/list_help.html.twig", 1);
        $this->blocks = [
            'content' => [$this, 'block_content'],
            'javascripts' => [$this, 'block_javascripts'],
        ];
    }

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

    protected function doDisplay(array $context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@App/help/helpassistance/list_help.html.twig"));

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

    }

    // line 2
    public function block_content($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "content"));

        // line 3
        echo "    <link href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css\" rel=\"stylesheet\" id=\"bootstrap-css\">
    <link href='https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css' rel='stylesheet' type='text/css'>
    <script src=\"https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js\"></script>
    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css\">
    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js\"></script>
    <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto|Varela+Round\">
    <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/icon?family=Material+Icons\">

    <style type=\"text/css\">
        table tr td, table tr th {
            max-width: 10vw;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        table {
            width: 100%;
        }

        img#hoverImage {
            /*transition:transform 0.25s ease;*/
            transition: transform .2s;
            margin: 0 auto;
            display: block;
        }

        img#hoverImage:hover {
            -webkit-transform: scale(1.5);
            -ms-transform: scale(1.5);
            transform: scale(10.5);
            display: block;
        }
    </style>

    <script type=\"text/javascript\">

        function check() {

            \$.ajax({
                type: 'POST',
                url: '";
        // line 44
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_notification");
        echo "',
                dataType: 'json',
                data: {}
            })
                .fail(function (response) {

                })
                .done(function (response) {

                    if (sessionStorage.length == 0) {
                        sessionStorage.setItem('response', JSON.stringify(response));
                    } else {

                        if (sessionStorage['response']) {
                            var datosdeusers = JSON.parse(sessionStorage.getItem('response'));
                            console.debug('Comparacion |Storage ->', datosdeusers['id_solicitud'], '| AJAX ->', response['id_solicitud']);
                            if (response['id_solicitud'] == datosdeusers['id_solicitud']) {

                                console.debug(response['lastupdate'], datosdeusers['lastupdate']);
                                moment().format();
                                var now = response['lastupdate'];
                                var then = datosdeusers['lastupdate'];

                                var ms = moment(now, \"YYYY-MM-DD HH:mm:ss\").diff(moment(then, \"YYYY-MM-DD HH:mm:ss\"));
                                var d = moment.duration(ms);

                                var maxminutes = 29;

                                console.debug(d.days(), d.hours(), d.minutes(), d.seconds());
                                //Si no han llegado mas helps a los 30 minutos se muestra la notificacion y despues se actualiza el record
                                if (d.minutes() > maxminutes || d.hours() > 1 || d.days() > 1) {
                                    // Si los recibidos son mayores que 0
                                    if (response['recibidos'] > 0) {
                                        // Se setean los textos a mostrar en la notificacion
                                        var idhelp = 0;
                                        var title2 = \"Alerta Helpdesk:\",
                                            more2 = {
                                                icon: \"https://colmodausa.com/ropa-colombiana/img/colmoda-logo-1447268971.jpg\",
                                                body: \"Hay \" + response['recibidos'] + \" ticket(s) durante mas de \" + maxminutes + \" minutos en estado Recibido.\",
                                                tag: \"n2\"
                                            };

                                        popUp(title2, more2, idhelp);
                                    }
                                    sessionStorage.setItem('response', JSON.stringify(response));
                                }
                            } else {

                                var idhelp = response['id_solicitud'];
                                var title2 = \"Alerta Helpdesk:\",
                                    more2 = {
                                        icon: \"https://colmodausa.com/ropa-colombiana/img/colmoda-logo-1447268971.jpg\",
                                        body: \"Hay un nuevo Ticket en estado Recibido.\",
                                        tag: \"n2\"
                                    };

                                popUp(title2, more2, idhelp);
                                sessionStorage.setItem('response', JSON.stringify(response));
                            }
                        }
                    }
                });
        }

        // setInterval(check, 6000);
        function permission() {
            Notification.requestPermission();
        }

        function popUp(title2, more2, idhelp) {

            if (Notification) {

                if (Notification.permission == \"granted\") {
                    var n = new Notification(title2, more2);

                    if (idhelp == 0) {

                    } else {
                        n.onclick = function (event) {
                            window.open('<?php echo \$_SERVER[\"HTTP_HOST\"].public_path(' / '); ?>helpdesk.php'); // fin de evento onclick
                            setTimeout(function () {
                                n.close()
                            }, 15000);
                            event.preventDefault();
                        }
                    }
                } else if (Notification.permission == \"default\") {//validacion si los pemisos estan concedidos de lo contrario envia un mensaje para se pemitidas
                    //Notification.requestPermission(function (permission) {
                    //alert(\"Primero da los permisos de notificacion\");
                    // console.debug(\"<?php echo \$_SERVER[\"HTTP_HOST\"].public_path('/'); ?>helpdesk.php/help_solicitud/\"+idhelp+\"/edit\");
                    // window.open(\"<?php echo \$_SERVER[\"HTTP_HOST\"].public_path('/'); ?>helpdesk.php/help_solicitud/\"+idhelp+\"/edit\");
                    Notification.requestPermission(function (permission) {

                        if (permission === \"granted\") {
                        }
                    });
                } else {
                    alert(\"Bloqueaste los permisos de notificaci��n\");
                }
            } else {
                alert(\"Tu navegador no es compatible con API Notification\");
            }
        }

        function show_modal(IdSolicitud) {

            \$.ajax(
                {
                    url: '";
        // line 153
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_list_help_data");
        echo "',
                    data: {'IdSolicitud': IdSolicitud},
                    success: function (response) {
                        \$.each(response, function (index, key) {


                            \$('#appbundle_helpassistance_descripcion').val(key.descripcion);
                            \$('#appbundle_helpassistance_createdBy').val(key.registrado_por);
                            \$('#appbundle_helpassistance_idAplicacionTarea').val(key.id_aplicacion_tarea).trigger('change');

                            \$('#appbundle_helpassistance_nota').val(key.nota);
                            \$('#usersoporte_help').val(key.id_asignado);
                            \$('#estados').val(key.id_estado);
                            \$('#id_solicitud').val(key.id_solicitud);
                            
                            
                            if (key.help_assistance_time == 0) {
                                \$('table#help_time tbody').html('')
                            }

                            var html = '';
                            \$.each(key.help_assistance_time, function () {
                                var value_help_s = this;

                                html += '<tr>';
                                html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                                html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                                html += '<td>' + value_help_s.nota + '</td>';
                                html += '<td>' + value_help_s.created_at + '</td>';
                                html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                                html += '</tr>';
                            })
                            \$('table#help_time tbody').html(html)
                            

                            \$('#myModal').modal('show');

                            \$.ajax({
                                url: '";
        // line 191
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_help_list");
        echo "',
                                dataType: 'json',
                                data: {'imgs': 'imgs', 'id_solicitud': key.id_solicitud},
                                success: function (response) {

                                    \$('#id_aplicacion_detalle option[value=\"'+key.id_detalle_aplicacion+'\"]').attr(\"selected\", \"selected\");

                                    var html = \"\";
                                    var patch = \"";
        // line 199
        echo twig_escape_filter($this->env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\AssetExtension')->getAssetUrl("uploads/help/"), "html", null, true);
        echo "\";

                                    \$.each(response, function (index, datas) {

                                        var urlsimage = patch + datas.image;
                                        html += '<div class=\"col-sm-1 col-sm-2 col-md-1\" style=\"z-index: 1\">';
                                        html += '<img src=\"' + urlsimage + '\" id=\"hoverImage\" class=\"thumbnail img-responsive\">';
                                        html += '</div>';
                                    });

                                    \$('#images').html(html)
                                }
                            });

                        });
                    }
                });
        }
    </script>

    <div class=\"container\">

        <table class=\"table table-responsive table-bordered nowrap\" id=\"hd_dt_table\">
            <thead>
            <tr>
               <th>Id <span style=\"visibility: hidden\">Creo este espacio</span></th>
                <th>Usuario</th>
                <th>Descripcion</th>
                <th>Estado</th>
                <th>Tienda</th>
                <th>Registrado Por</th>
                <th>Creado</th>
                <th>Action</th>
            </tr>
            </thead>
            <thead>
            <tr>
                <td><input type=\"number\" size=\"20\" id=\"id_solicitud_s\" class=\"form-control help_user-search\"></td>
                <td>";
        // line 238
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["employee"] ?? $this->getContext($context, "employee")), "idUserAssigned", []), 'widget');
        echo "
                </td>
                <td><input type=\"text\" id=\"descripcion\" class=\"form-control help_user-search\"></td>
                <td>";
        // line 242
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["employee"] ?? $this->getContext($context, "employee")), "idEstado", []), 'widget');
        echo "
                </td>
                <td>";
        // line 245
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["employee"] ?? $this->getContext($context, "employee")), "idTienda", []), 'widget');
        echo "
                </td>
                <td>";
        // line 248
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["employee"] ?? $this->getContext($context, "employee")), "createdBy", []), 'widget');
        echo "
                </td>
                <td>
                    <input type=\"date\" id=\"5\"
                           class=\"form-control help_user-search datepicker\">
                </td>
            </tr>
            </thead>
            <tbody></tbody>
            <tfoot>
            <tr>
                <th>Id</th>
                <th>Usuario</th>
                <th>Descripcion</th>
                <th>Estado</th>
                <th>Tienda</th>
                <th>Registrado Por</th>
                <th>Creado</th>
                <th></th>
            </tr>
            </tfoot>
        </table>

        <div class=\"modal fade\" id=\"myModal\" role=\"dialog\">
            <div class=\"modal-dialog\">

                <div class=\"modal-content\">
                    <div class=\"modal-header\">
                        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>
                        <h4 class=\"modal-title\">Editar Solicitud</h4>
                    </div>
                    <div class=\"modal-body\">
                        <div class=\"container\">
                            <form id=\"form\" method=\"post\" class=\"form-horizontal\">

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 285
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "descripcion", []), 'label', ["label" => "Descripcion"]);
        echo "</label>
                                    <div class=\"col-md-4\">";
        // line 287
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "descripcion", []), 'widget', ["attr" => ["readonly" => "true"]]);
        echo "
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 293
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "createdBy", []), 'label', ["label" => "Usuario"]);
        echo "</label>
                                    <div class=\"col-md-4\">";
        // line 295
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "createdBy", []), 'widget');
        echo "
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> Imagenes</label>
                                    <div id=\"images\"></div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 307
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "idAplicacionTarea", []), 'label', ["label" => "Aplicacion"]);
        echo "</label>
                                    <div class=\"col-md-4\">";
        // line 309
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "idAplicacionTarea", []), 'widget');
        echo "
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\">Aplicacion Detalle</label>
                                    <div class=\"col-md-4\">
                                        <div style=\"display: none\">";
        // line 317
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "idDetalleAplicacion", []), 'widget');
        echo "
                                        </div>
                                        <select class=\"form-control\" id=\"id_aplicacion_detalle\" data-live-search=\"true\">
                                            <option></option>
                                        </select>
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 327
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "idUserAssigned", []), 'label', ["label" => "Usuario Asignado"]);
        echo "</label>
                                    <div class=\"col-md-4\">
                                        <select id=\"usersoporte_help\" class=\"form-control\">
                                            <option></option>";
        // line 331
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["usersoporte_help"] ?? $this->getContext($context, "usersoporte_help")));
        foreach ($context['_seq'] as $context["_key"] => $context["usersoporte_helps"]) {
            // line 332
            echo "                                                <option value=\"";
            echo twig_escape_filter($this->env, $this->getAttribute($context["usersoporte_helps"], "idEmployee", []), "html", null, true);
            echo "\">";
            echo twig_escape_filter($this->env, $this->getAttribute($context["usersoporte_helps"], "empfullname", []), "html", null, true);
            echo "</option>";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['usersoporte_helps'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 334
        echo "                                        </select>
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 340
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "nota", []), 'label', ["label" => "Nota"]);
        echo "</label>
                                    <div class=\"col-md-4\">";
        // line 342
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "nota", []), 'widget');
        echo "
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\">";
        // line 348
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute(($context["form"] ?? $this->getContext($context, "form")), "idEstado", []), 'label', ["label" => "Estado"]);
        echo "</label>
                                    <div class=\"col-md-4\">

                                        <select id=\"estados\" class=\"form-control\">
                                            <option></option>";
        // line 353
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["form_state"] ?? $this->getContext($context, "form_state")));
        foreach ($context['_seq'] as $context["_key"] => $context["state"]) {
            // line 354
            echo "                                                <option value=\"";
            echo twig_escape_filter($this->env, $this->getAttribute($context["state"], "idEstado", []), "html", null, true);
            echo "\">";
            echo twig_escape_filter($this->env, $this->getAttribute($context["state"], "nombre", []), "html", null, true);
            echo "</option>";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['state'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 356
        echo "                                        </select>
                                    </div>
                                </div>
                                
                                <div class=\"form-group\">

                                    <a href=\"#\" class=\"btn btn-success\" data-toggle=\"modal\" id=\"add_time_soport\"><i
                                                class=\"material-icons\">&#xE147;</i> <span>Agregar Tiempo</span></a>

                                    <table class=\"table table-responsive table-bordered table-striped table-hover\"
                                           id=\"help_time\" style=\"width: auto\">
                                        <thead>
                                        <tr>
                                            <th>Encargado</th>
                                            <th>Tiempo Empleado</th>
                                            <th>Motivo</th>
                                            <th>Fecha</th>
                                        </tr>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                    </table>
                                </div>

                                <input type=\"hidden\" id=\"id_solicitud\">
                            </form>
                        </div>
                    </div>
                    <div class=\"modal-footer\">
                        <button type=\"button\" class=\"btn btn-default\" id=\"send_edit_help\" data-dismiss=\"modal\">Enviar
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <div id=\"add_time_empled\" class=\"modal fade\">
            <div class=\"modal-dialog\">
                <div class=\"modal-content\">
                    <form>
                        <div class=\"modal-header\">
                            <h4 class=\"modal-title\">Agregar </h4>
                            <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>
                        </div>
                        <div class=\"modal-body\">

                            <div class=\"form-group\">
                                <label>Soportista</label>
                                <select class=\"form-control\" id=\"id_soport_time_add\">
                                </select>
                            </div>
                            <div class=\"form-group\">
                                <label>Tiempo Usado</label>
                                <input type=\"time\" class=\"form-control\" id=\"id_tiempo_usado_add\">
                            </div>
                            <div class=\"form-group\">
                                <label>Motivo</label>
                                <textarea class=\"form-control\" id=\"id_motivo_add\" required></textarea>
                            </div>
                            <div class=\"form-group\">
                                <label>Fecha</label>
                                <input type=\"datetime-local\" class=\"form-control\" id=\"id_fecha_add\" value=\"\">
                            </div>
                        </div>
                        <div class=\"modal-footer\">
                            <input type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" value=\"Cancelar\">
                            <input type=\"button\" class=\"btn btn-info\" id=\"add_soport_time\" value=\"Agregar\">
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
        <div id=\"edit_help_timeModal\" class=\"modal fade\">
            <div class=\"modal-dialog\">
                <div class=\"modal-content\">
                    <form>
                        <div class=\"modal-header\">
                            <h4 class=\"modal-title\">Editar </h4>
                            <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>
                        </div>
                        <div class=\"modal-body\">

                            <input type=\"hidden\" id=\"id_aplication\">
                            <div class=\"form-group\">
                                <label>Soportista</label>
                                <select class=\"form-control\" id=\"id_soport_time_edit\">
                                </select>
                            </div>
                            <div class=\"form-group\">
                                <label>Tiempo Usado</label>
                                <input type=\"time\" class=\"form-control\" id=\"id_tiempo_usado_edit\">
                            </div>
                            <div class=\"form-group\">
                                <label>Motivo</label>
                                <textarea class=\"form-control\" id=\"id_motivo_edit\"></textarea>
                            </div>
                            <div class=\"form-group\">
                                <label>Fecha</label>
                                <input type=\"datetime-local\" class=\"form-control\" id=\"id_fecha_edit\" value=\"\">
                            </div>
                        </div>
                        <div class=\"modal-footer\">
                            <input type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" value=\"Cancelar\">
                            <input type=\"button\" class=\"btn btn-info\" id=\"edit_soport_time\" value=\"Editar\">
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
    </div>

    <script type=\"text/javascript\">
        \$(function () {
            // \$('.datepicker').datepicker({
            //     dateFormat: \"yy-mm-dd\",
            //     showOn: \"button\",
            //     showAnim: 'slideDown',
            //     showButtonPanel: true ,
            //     autoSize: true,
            //     buttonImage: \"//jqueryui.com/resources/demos/datepicker/images/calendar.gif\",
            //     buttonImageOnly: true,
            //     buttonText: \"Select date\",
            //     closeText: \"Clear\"
            // })
        });
        
        \$(document).on('show.bs.modal', '.modal', function (event) {
            var zIndex = 1040 + (10 * \$('.modal:visible').length);
            \$(this).css('z-index', zIndex);
            setTimeout(function () {
                \$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
            }, 0);
        });

        function zeroPadded(val) {
            if (val >= 10)
                return val;
            else
                return '0' + val;
        }
        
        \$(document).on('click', '#edit_time_empled', function (event) {

            var id_aplicacion_time = \$(this).data('id_aplicacion_time');

            \$.ajax({
                url: '";
        // line 505
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_list_help_data");
        echo "',
                dataType: 'json',
                data: {'edit': '1', 'id_aplicacion_time':id_aplicacion_time,'process_edit':1},
                success: function (response) {

                    \$('input#id_aplication').val(id_aplicacion_time);

                    var html = \"\";
                    html += '<option value=\"\">Seleccione un Asesor</option>';
                    \$.each(response.emplo, function (index, datas) {
                        html += '<option value=\"'+this.id_employee+'\">'+this.empfullname+'</option>'
                    });
                    \$('select#id_soport_time_edit').html(html)

                    \$.each(response.edit_helpAssistances, function (index, datas) {
                        \$(\"select#id_soport_time_edit\").val(this.created_by).change();
                        \$('input#id_tiempo_usado_edit').val(this.tiempo_trabajado)
                        \$('textarea#id_motivo_edit').val(this.nota)
                        var d = new Date();
                        \$('input#id_fecha_edit[type=datetime-local]').val(d.getFullYear()+\"-\"+zeroPadded(d.getMonth() + 1)+\"-\"+zeroPadded(d.getDate())+\"T\"+d.getHours()+\":\"+d.getMinutes()+\":\"+d.getSeconds());
                    });


                    \$('#edit_help_timeModal').modal('show')
                }
            });
        });
        
        \$(document).on('click', '#add_time_soport', function (event) {

            \$.ajax({
                url: '";
        // line 536
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_list_help_data");
        echo "',
                dataType: 'json',
                data: {'edit': '1', 'process_edit': 3,'select_asesor':1},
                success: function (response) {

                    var html = \"\";
                    html += '<option value=\"\">Seleccione un Asesor</option>';
                    \$.each(response.emplo, function (index, datas) {
                        html += '<option value=\"'+this.id_employee+'\">'+this.empfullname+'</option>'
                    });
                    \$('select#id_soport_time_add').html(html);
                }
            });

            \$('input#id_fecha_add[type=datetime-local]').val(moment().format('YYYY-MM-DDThh:mm'));

            \$('#add_time_empled').modal('show')

        });
        
        \$(document).on('click', '#add_soport_time', function (event) {

            \$.ajax({
                url: '";
        // line 559
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_list_help_data");
        echo "',
                dataType: 'json',
                data: {
                    'edit': '1',
                    'process_edit': 3,
                    'insert_asesor':1,
                    'id_soport_time_add':\$('#id_soport_time_add').val(),
                    'id_tiempo_usado_add':\$('#id_tiempo_usado_add').val(),
                    'id_motivo_add':\$('#id_motivo_add').val(),
                    'id_fecha_add':\$('#id_fecha_add').val(),
                    'IdSolicitud':\$('#id_solicitud').val(),
                },
                success: function (response) {
                    
                    var html = '';
                    \$.each(response.help_assistance_time, function (index, key) {
                        var value_help_s = this;
                        html += '<tr>';
                        html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                        html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                        html += '<td>' + value_help_s.nota + '</td>';
                        html += '<td>' + value_help_s.created_at + '</td>';
                        html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                        html += '</tr>';
                    });
                    \$('table#help_time tbody').html(html)
                    
                    alert(\"Datos Registrados\")
                    \$(\"#add_time_empled .close\").click()
                    
                }
            });
        });
        
        \$(document).on('click', '#edit_soport_time', function (event) {
            \$.ajax({
                url: '";
        // line 595
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_list_help_data");
        echo "',
                dataType: 'json',
                data: {
                    'edit': '1',
                    'process_edit':4,
                    'edit_asesor':1,
                    'id_soport_time_edit':\$('#id_soport_time_edit').val(),
                    'id_tiempo_usado_edit':\$('#id_tiempo_usado_edit').val(),
                    'id_motivo_edit':\$('#id_motivo_edit').val(),
                    'id_fecha_edit':\$('#id_fecha_edit').val(),
                    'IdSolicitud':\$('#id_solicitud').val(),
                },
                success: function (response) {
                    var html = '';



                    \$.each(response.help_assistance_time, function (index, key) {
                        var value_help_s = this;


                        html += '<tr>';
                        html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                        html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                        html += '<td>' + value_help_s.nota + '</td>';
                        html += '<td>' + value_help_s.created_at + '</td>';
                        html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                        html += '</tr>';
                    });
                    \$('table#help_time tbody').html(html)

                    alert(\"Datos Editados\");
                    \$(\"#edit_help_timeModal .close\").click();

                }
            });
        });
    </script>";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 636
    public function block_javascripts($context, array $blocks = [])
    {
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));

        // line 637
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "
    <script type=\"text/javascript\">

        \$(document).ready(function () {

            \$('#hd_dt_table tfoot th').each(function () {
                var title = \$(this).text();
                if (title.trim() != '') {
                    \$(this).html('<input type=\"hidden\" class=\"\" placeholder=\"Search ' + title + '\" />');
                }
            });

            var table = \$('#hd_dt_table').DataTable({
                stateSave: true,
                \"responsive\": true,
                \"columnDefs\":
                    [
                        // These are the column name variables that will be sent to the server
                        {\"name\": \"id\", \"targets\": 0},
                        {\"name\": \"usuario\", \"targets\": 1},
                        {\"name\": \"descripcion\", \"targets\": 2, \"hideIfEmpty\": true},
                        {\"name\": \"estado\", \"targets\": 3},
                        {\"name\": \"tienda\", \"targets\": 4},
                        {\"name\": \"created_by\", \"targets\": 5},
                        {\"name\": \"created_at\", \"targets\": 6},
                        {
                            \"name\": \"button_id\", \"targets\": 7, \"render\": function (data, type, row) {

                                return \"<button type='button' id='edit_solicitud' \" +
                                    \"class='btn btn-primary btn-sm' data-target='#myModal' data-dismiss='modal'\" +
                                    \"data-backdrop='false'\" +
                                    \"data-id_employees='1'\" +
                                    \"onclick='show_modal(\" + data + \")'>\" +
                                    \"<span class='glyphicon glyphicon-edit' aria-hidden='true'></span>\"
                                    +
                                    \"</button>\";
                            }
                        },
                    ],
                \"processing\": true,
                \"serverSide\": true,
                \"ajax\": {
                    \"url\": \"";
        // line 679
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("helpassistance_list_help");
        echo "\",
                    \"type\": \"POST\"
                },
                \"paging\": true,
                \"info\": true,
                \"searching\": true,
                \"pageLength\": 10,
                \"order\": [[0, 'desc']]
            });

            table.columns().every(function () {
                var that = this;

                \$('input', this.footer()).on('keyup change clear', function () {
                    if (that.search() !== this.value) {
                        that
                            .search(this.value)
                            .draw();
                    }
                });
            });

            \$('#form_idUserAssigned').change(function () {
                var idUserAssigned = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Usuario') {
                        \$(this).val(idUserAssigned).trigger(\"change\");
                    }
                })
            });
            
            \$('#id_solicitud_s').keyup(function () {

                var id_solicitud_s = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Id') {
                        \$(this).val(id_solicitud_s).trigger(\"change\");
                    }
                })
            });

            \$('#descripcion').keyup(function () {

                var description = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Descripcion') {
                        \$(this).val(description).trigger(\"change\");
                    }
                })
            });

            \$('#form_idEstado').change(function () {
                var idestado = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Estado') {
                        \$(this).val(idestado).trigger(\"change\");
                    }
                })
            });

            \$('#form_idTienda').change(function () {
                var idtienda = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Tienda') {
                        \$(this).val(idtienda).trigger(\"change\");
                    }
                })
            });

            \$('#form_createdBy').change(function () {
                var idcreated_by = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Registrado Por') {
                        \$(this).val(idcreated_by).trigger(\"change\");
                    }
                })
            });

            \$('#myModal').on('shown.bs.modal', function () {
                \$(this).before(\$('.modal-backdrop'));
                \$(this).css(\"z-index\", parseInt(\$('.modal-backdrop').css('z-index')) + 1);
            });

            \$('#send_edit_help').click(function () {

                if (\$('#usersoporte_help').val().trim() === '') {
                    alert(\"El campo usuario asignado, no puede estar vacio\");
                    return false
                }

                if (\$('#appbundle_helpassistance_idAplicacionTarea').val().trim() === '') {
                    alert(\"Debe Elegir una aplicacion\");
                    return false
                }

                // if (\$(\"#appbundle_helpassistance_idAplicacionTarea\").val() == undefined ? '' : \$(\"#appbundle_helpassistance_idAplicacionTarea\").val().trim()) {
                //     alert(\"Debe Elegir una Aplicacion\");
                //     return false
                // }

                if (\$('#id_aplicacion_detalle').val().trim() === '') {
                    alert(\"Debe Elegir un Detalle de la aplicacion\");
                    return false
                }

                \$.ajax({
                    url: '";
        // line 797
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_help_list");
        echo "',
                    dataType: 'json',
                    data: {
                        'id_solicitud': \$('#id_solicitud').val(),
                        'estados': \$('#estados').val(),
                        'nota': \$('#appbundle_helpassistance_nota').val(),
                        'usersoporte_help': \$('#usersoporte_help').val(),
                        'idAplicacionTarea': \$('#appbundle_helpassistance_idAplicacionTarea').val(),
                        'idAplicaciondetalle': \$('#id_aplicacion_detalle').val().replace(/ /g, '%20'),
                        'update': 'update'
                    },
                    success: function (data) {
                        alert(\"Help Actualizado\");
                        window.location.reload()
                    }
                })

            });

            \$('#appbundle_helpassistance_idAplicacionTarea').change(function (evt) {
                evt.preventDefault();
                let aplicacion = \$(this).val();
                document.querySelectorAll('#id_aplicacion_detalle option').forEach(option => option.remove());
                \$.ajax(
                    {
                        url: '";
        // line 822
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("helpassistance_help_list");
        echo "',
                        dataType: 'json',
                        data: {'id_aplicacion': aplicacion, 'aplicacion': 'aplicacion'},
                        success: function (response) {

                            var retval = [];
                            \$.each(response, function (i, value) {
                                retval.push(value['id']);
                            });

                            retval.forEach(function (item, index) {

                                \$(\"#appbundle_helpassistance_idDetalleAplicacion option\").each(function (i, k) {

                                    var values_op = \$(this).val();

                                    if (item == values_op) {
                                        \$('#id_aplicacion_detalle').append(this).selectpicker();
                                    }
                                });
                            });
                        }
                    })
            });

        });
    </script>";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    public function getTemplateName()
    {
        return "@App/help/helpassistance/list_help.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  972 => 822,  944 => 797,  823 => 679,  778 => 637,  772 => 636,  727 => 595,  688 => 559,  662 => 536,  628 => 505,  477 => 356,  467 => 354,  463 => 353,  456 => 348,  447 => 342,  443 => 340,  435 => 334,  425 => 332,  421 => 331,  415 => 327,  402 => 317,  392 => 309,  388 => 307,  373 => 295,  369 => 293,  360 => 287,  356 => 285,  316 => 248,  311 => 245,  306 => 242,  300 => 238,  259 => 199,  248 => 191,  207 => 153,  95 => 44,  52 => 3,  46 => 2,  22 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Source("{% extends \"@App/Layouts/layout.html.twig\" %}
{% block content %}
    <link href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css\" rel=\"stylesheet\" id=\"bootstrap-css\">
    <link href='https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css' rel='stylesheet' type='text/css'>
    <script src=\"https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js\"></script>
    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css\">
    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js\"></script>
    <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto|Varela+Round\">
    <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/icon?family=Material+Icons\">

    <style type=\"text/css\">
        table tr td, table tr th {
            max-width: 10vw;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        table {
            width: 100%;
        }

        img#hoverImage {
            /*transition:transform 0.25s ease;*/
            transition: transform .2s;
            margin: 0 auto;
            display: block;
        }

        img#hoverImage:hover {
            -webkit-transform: scale(1.5);
            -ms-transform: scale(1.5);
            transform: scale(10.5);
            display: block;
        }
    </style>

    <script type=\"text/javascript\">

        function check() {

            \$.ajax({
                type: 'POST',
                url: '{{ url('helpassistance_notification') }}',
                dataType: 'json',
                data: {}
            })
                .fail(function (response) {

                })
                .done(function (response) {

                    if (sessionStorage.length == 0) {
                        sessionStorage.setItem('response', JSON.stringify(response));
                    } else {

                        if (sessionStorage['response']) {
                            var datosdeusers = JSON.parse(sessionStorage.getItem('response'));
                            console.debug('Comparacion |Storage ->', datosdeusers['id_solicitud'], '| AJAX ->', response['id_solicitud']);
                            if (response['id_solicitud'] == datosdeusers['id_solicitud']) {

                                console.debug(response['lastupdate'], datosdeusers['lastupdate']);
                                moment().format();
                                var now = response['lastupdate'];
                                var then = datosdeusers['lastupdate'];

                                var ms = moment(now, \"YYYY-MM-DD HH:mm:ss\").diff(moment(then, \"YYYY-MM-DD HH:mm:ss\"));
                                var d = moment.duration(ms);

                                var maxminutes = 29;

                                console.debug(d.days(), d.hours(), d.minutes(), d.seconds());
                                //Si no han llegado mas helps a los 30 minutos se muestra la notificacion y despues se actualiza el record
                                if (d.minutes() > maxminutes || d.hours() > 1 || d.days() > 1) {
                                    // Si los recibidos son mayores que 0
                                    if (response['recibidos'] > 0) {
                                        // Se setean los textos a mostrar en la notificacion
                                        var idhelp = 0;
                                        var title2 = \"Alerta Helpdesk:\",
                                            more2 = {
                                                icon: \"https://colmodausa.com/ropa-colombiana/img/colmoda-logo-1447268971.jpg\",
                                                body: \"Hay \" + response['recibidos'] + \" ticket(s) durante mas de \" + maxminutes + \" minutos en estado Recibido.\",
                                                tag: \"n2\"
                                            };

                                        popUp(title2, more2, idhelp);
                                    }
                                    sessionStorage.setItem('response', JSON.stringify(response));
                                }
                            } else {

                                var idhelp = response['id_solicitud'];
                                var title2 = \"Alerta Helpdesk:\",
                                    more2 = {
                                        icon: \"https://colmodausa.com/ropa-colombiana/img/colmoda-logo-1447268971.jpg\",
                                        body: \"Hay un nuevo Ticket en estado Recibido.\",
                                        tag: \"n2\"
                                    };

                                popUp(title2, more2, idhelp);
                                sessionStorage.setItem('response', JSON.stringify(response));
                            }
                        }
                    }
                });
        }

        // setInterval(check, 6000);
        function permission() {
            Notification.requestPermission();
        }

        function popUp(title2, more2, idhelp) {

            if (Notification) {

                if (Notification.permission == \"granted\") {
                    var n = new Notification(title2, more2);

                    if (idhelp == 0) {

                    } else {
                        n.onclick = function (event) {
                            window.open('<?php echo \$_SERVER[\"HTTP_HOST\"].public_path(' / '); ?>helpdesk.php'); // fin de evento onclick
                            setTimeout(function () {
                                n.close()
                            }, 15000);
                            event.preventDefault();
                        }
                    }
                } else if (Notification.permission == \"default\") {//validacion si los pemisos estan concedidos de lo contrario envia un mensaje para se pemitidas
                    //Notification.requestPermission(function (permission) {
                    //alert(\"Primero da los permisos de notificacion\");
                    // console.debug(\"<?php echo \$_SERVER[\"HTTP_HOST\"].public_path('/'); ?>helpdesk.php/help_solicitud/\"+idhelp+\"/edit\");
                    // window.open(\"<?php echo \$_SERVER[\"HTTP_HOST\"].public_path('/'); ?>helpdesk.php/help_solicitud/\"+idhelp+\"/edit\");
                    Notification.requestPermission(function (permission) {

                        if (permission === \"granted\") {
                        }
                    });
                } else {
                    alert(\"Bloqueaste los permisos de notificaci��n\");
                }
            } else {
                alert(\"Tu navegador no es compatible con API Notification\");
            }
        }

        function show_modal(IdSolicitud) {

            \$.ajax(
                {
                    url: '{{ url('helpassistance_list_help_data') }}',
                    data: {'IdSolicitud': IdSolicitud},
                    success: function (response) {
                        \$.each(response, function (index, key) {


                            \$('#appbundle_helpassistance_descripcion').val(key.descripcion);
                            \$('#appbundle_helpassistance_createdBy').val(key.registrado_por);
                            \$('#appbundle_helpassistance_idAplicacionTarea').val(key.id_aplicacion_tarea).trigger('change');

                            \$('#appbundle_helpassistance_nota').val(key.nota);
                            \$('#usersoporte_help').val(key.id_asignado);
                            \$('#estados').val(key.id_estado);
                            \$('#id_solicitud').val(key.id_solicitud);
                            
                            
                            if (key.help_assistance_time == 0) {
                                \$('table#help_time tbody').html('')
                            }

                            var html = '';
                            \$.each(key.help_assistance_time, function () {
                                var value_help_s = this;

                                html += '<tr>';
                                html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                                html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                                html += '<td>' + value_help_s.nota + '</td>';
                                html += '<td>' + value_help_s.created_at + '</td>';
                                html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                                html += '</tr>';
                            })
                            \$('table#help_time tbody').html(html)
                            

                            \$('#myModal').modal('show');

                            \$.ajax({
                                url: '{{ url('helpassistance_help_list') }}',
                                dataType: 'json',
                                data: {'imgs': 'imgs', 'id_solicitud': key.id_solicitud},
                                success: function (response) {

                                    \$('#id_aplicacion_detalle option[value=\"'+key.id_detalle_aplicacion+'\"]').attr(\"selected\", \"selected\");

                                    var html = \"\";
                                    var patch = \"{{ asset('uploads/help/') }}\";

                                    \$.each(response, function (index, datas) {

                                        var urlsimage = patch + datas.image;
                                        html += '<div class=\"col-sm-1 col-sm-2 col-md-1\" style=\"z-index: 1\">';
                                        html += '<img src=\"' + urlsimage + '\" id=\"hoverImage\" class=\"thumbnail img-responsive\">';
                                        html += '</div>';
                                    });

                                    \$('#images').html(html)
                                }
                            });

                        });
                    }
                });
        }
    </script>

    <div class=\"container\">

        <table class=\"table table-responsive table-bordered nowrap\" id=\"hd_dt_table\">
            <thead>
            <tr>
               <th>Id <span style=\"visibility: hidden\">Creo este espacio</span></th>
                <th>Usuario</th>
                <th>Descripcion</th>
                <th>Estado</th>
                <th>Tienda</th>
                <th>Registrado Por</th>
                <th>Creado</th>
                <th>Action</th>
            </tr>
            </thead>
            <thead>
            <tr>
                <td><input type=\"number\" size=\"20\" id=\"id_solicitud_s\" class=\"form-control help_user-search\"></td>
                <td>
                    {{ form_widget(employee.idUserAssigned) }}
                </td>
                <td><input type=\"text\" id=\"descripcion\" class=\"form-control help_user-search\"></td>
                <td>
                    {{ form_widget(employee.idEstado) }}
                </td>
                <td>
                    {{ form_widget(employee.idTienda) }}
                </td>
                <td>
                    {{ form_widget(employee.createdBy) }}
                </td>
                <td>
                    <input type=\"date\" id=\"5\"
                           class=\"form-control help_user-search datepicker\">
                </td>
            </tr>
            </thead>
            <tbody></tbody>
            <tfoot>
            <tr>
                <th>Id</th>
                <th>Usuario</th>
                <th>Descripcion</th>
                <th>Estado</th>
                <th>Tienda</th>
                <th>Registrado Por</th>
                <th>Creado</th>
                <th></th>
            </tr>
            </tfoot>
        </table>

        <div class=\"modal fade\" id=\"myModal\" role=\"dialog\">
            <div class=\"modal-dialog\">

                <div class=\"modal-content\">
                    <div class=\"modal-header\">
                        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>
                        <h4 class=\"modal-title\">Editar Solicitud</h4>
                    </div>
                    <div class=\"modal-body\">
                        <div class=\"container\">
                            <form id=\"form\" method=\"post\" class=\"form-horizontal\">

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.descripcion,'Descripcion') }}</label>
                                    <div class=\"col-md-4\">
                                        {{ form_widget(form.descripcion,{'attr':{'readonly':'true'}}) }}
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.createdBy,'Usuario') }}</label>
                                    <div class=\"col-md-4\">
                                        {{ form_widget(form.createdBy) }}
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> Imagenes</label>
                                    <div id=\"images\"></div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.idAplicacionTarea,'Aplicacion') }}</label>
                                    <div class=\"col-md-4\">
                                        {{ form_widget(form.idAplicacionTarea) }}
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\">Aplicacion Detalle</label>
                                    <div class=\"col-md-4\">
                                        <div style=\"display: none\">
                                            {{ form_widget(form.idDetalleAplicacion) }}
                                        </div>
                                        <select class=\"form-control\" id=\"id_aplicacion_detalle\" data-live-search=\"true\">
                                            <option></option>
                                        </select>
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.idUserAssigned,'Usuario Asignado') }}</label>
                                    <div class=\"col-md-4\">
                                        <select id=\"usersoporte_help\" class=\"form-control\">
                                            <option></option>
                                            {% for usersoporte_helps in usersoporte_help %}
                                                <option value=\"{{ usersoporte_helps.idEmployee }}\">{{ usersoporte_helps.empfullname }}</option>
                                            {% endfor %}
                                        </select>
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.nota,'Nota') }}</label>
                                    <div class=\"col-md-4\">
                                        {{ form_widget(form.nota) }}
                                    </div>
                                </div>

                                <div class=\"form-group\">
                                    <label class=\"col-md-1 control-label\"
                                           for=\"textinput\"> {{ form_label(form.idEstado,'Estado') }}</label>
                                    <div class=\"col-md-4\">

                                        <select id=\"estados\" class=\"form-control\">
                                            <option></option>
                                            {% for state in form_state %}
                                                <option value=\"{{ state.idEstado }}\">{{ state.nombre }}</option>
                                            {% endfor %}
                                        </select>
                                    </div>
                                </div>
                                
                                <div class=\"form-group\">

                                    <a href=\"#\" class=\"btn btn-success\" data-toggle=\"modal\" id=\"add_time_soport\"><i
                                                class=\"material-icons\">&#xE147;</i> <span>Agregar Tiempo</span></a>

                                    <table class=\"table table-responsive table-bordered table-striped table-hover\"
                                           id=\"help_time\" style=\"width: auto\">
                                        <thead>
                                        <tr>
                                            <th>Encargado</th>
                                            <th>Tiempo Empleado</th>
                                            <th>Motivo</th>
                                            <th>Fecha</th>
                                        </tr>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                    </table>
                                </div>

                                <input type=\"hidden\" id=\"id_solicitud\">
                            </form>
                        </div>
                    </div>
                    <div class=\"modal-footer\">
                        <button type=\"button\" class=\"btn btn-default\" id=\"send_edit_help\" data-dismiss=\"modal\">Enviar
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <div id=\"add_time_empled\" class=\"modal fade\">
            <div class=\"modal-dialog\">
                <div class=\"modal-content\">
                    <form>
                        <div class=\"modal-header\">
                            <h4 class=\"modal-title\">Agregar </h4>
                            <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>
                        </div>
                        <div class=\"modal-body\">

                            <div class=\"form-group\">
                                <label>Soportista</label>
                                <select class=\"form-control\" id=\"id_soport_time_add\">
                                </select>
                            </div>
                            <div class=\"form-group\">
                                <label>Tiempo Usado</label>
                                <input type=\"time\" class=\"form-control\" id=\"id_tiempo_usado_add\">
                            </div>
                            <div class=\"form-group\">
                                <label>Motivo</label>
                                <textarea class=\"form-control\" id=\"id_motivo_add\" required></textarea>
                            </div>
                            <div class=\"form-group\">
                                <label>Fecha</label>
                                <input type=\"datetime-local\" class=\"form-control\" id=\"id_fecha_add\" value=\"\">
                            </div>
                        </div>
                        <div class=\"modal-footer\">
                            <input type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" value=\"Cancelar\">
                            <input type=\"button\" class=\"btn btn-info\" id=\"add_soport_time\" value=\"Agregar\">
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
        <div id=\"edit_help_timeModal\" class=\"modal fade\">
            <div class=\"modal-dialog\">
                <div class=\"modal-content\">
                    <form>
                        <div class=\"modal-header\">
                            <h4 class=\"modal-title\">Editar </h4>
                            <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>
                        </div>
                        <div class=\"modal-body\">

                            <input type=\"hidden\" id=\"id_aplication\">
                            <div class=\"form-group\">
                                <label>Soportista</label>
                                <select class=\"form-control\" id=\"id_soport_time_edit\">
                                </select>
                            </div>
                            <div class=\"form-group\">
                                <label>Tiempo Usado</label>
                                <input type=\"time\" class=\"form-control\" id=\"id_tiempo_usado_edit\">
                            </div>
                            <div class=\"form-group\">
                                <label>Motivo</label>
                                <textarea class=\"form-control\" id=\"id_motivo_edit\"></textarea>
                            </div>
                            <div class=\"form-group\">
                                <label>Fecha</label>
                                <input type=\"datetime-local\" class=\"form-control\" id=\"id_fecha_edit\" value=\"\">
                            </div>
                        </div>
                        <div class=\"modal-footer\">
                            <input type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" value=\"Cancelar\">
                            <input type=\"button\" class=\"btn btn-info\" id=\"edit_soport_time\" value=\"Editar\">
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
    </div>

    <script type=\"text/javascript\">
        \$(function () {
            // \$('.datepicker').datepicker({
            //     dateFormat: \"yy-mm-dd\",
            //     showOn: \"button\",
            //     showAnim: 'slideDown',
            //     showButtonPanel: true ,
            //     autoSize: true,
            //     buttonImage: \"//jqueryui.com/resources/demos/datepicker/images/calendar.gif\",
            //     buttonImageOnly: true,
            //     buttonText: \"Select date\",
            //     closeText: \"Clear\"
            // })
        });
        
        \$(document).on('show.bs.modal', '.modal', function (event) {
            var zIndex = 1040 + (10 * \$('.modal:visible').length);
            \$(this).css('z-index', zIndex);
            setTimeout(function () {
                \$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
            }, 0);
        });

        function zeroPadded(val) {
            if (val >= 10)
                return val;
            else
                return '0' + val;
        }
        
        \$(document).on('click', '#edit_time_empled', function (event) {

            var id_aplicacion_time = \$(this).data('id_aplicacion_time');

            \$.ajax({
                url: '{{ url('helpassistance_list_help_data') }}',
                dataType: 'json',
                data: {'edit': '1', 'id_aplicacion_time':id_aplicacion_time,'process_edit':1},
                success: function (response) {

                    \$('input#id_aplication').val(id_aplicacion_time);

                    var html = \"\";
                    html += '<option value=\"\">Seleccione un Asesor</option>';
                    \$.each(response.emplo, function (index, datas) {
                        html += '<option value=\"'+this.id_employee+'\">'+this.empfullname+'</option>'
                    });
                    \$('select#id_soport_time_edit').html(html)

                    \$.each(response.edit_helpAssistances, function (index, datas) {
                        \$(\"select#id_soport_time_edit\").val(this.created_by).change();
                        \$('input#id_tiempo_usado_edit').val(this.tiempo_trabajado)
                        \$('textarea#id_motivo_edit').val(this.nota)
                        var d = new Date();
                        \$('input#id_fecha_edit[type=datetime-local]').val(d.getFullYear()+\"-\"+zeroPadded(d.getMonth() + 1)+\"-\"+zeroPadded(d.getDate())+\"T\"+d.getHours()+\":\"+d.getMinutes()+\":\"+d.getSeconds());
                    });


                    \$('#edit_help_timeModal').modal('show')
                }
            });
        });
        
        \$(document).on('click', '#add_time_soport', function (event) {

            \$.ajax({
                url: '{{ url('helpassistance_list_help_data') }}',
                dataType: 'json',
                data: {'edit': '1', 'process_edit': 3,'select_asesor':1},
                success: function (response) {

                    var html = \"\";
                    html += '<option value=\"\">Seleccione un Asesor</option>';
                    \$.each(response.emplo, function (index, datas) {
                        html += '<option value=\"'+this.id_employee+'\">'+this.empfullname+'</option>'
                    });
                    \$('select#id_soport_time_add').html(html);
                }
            });

            \$('input#id_fecha_add[type=datetime-local]').val(moment().format('YYYY-MM-DDThh:mm'));

            \$('#add_time_empled').modal('show')

        });
        
        \$(document).on('click', '#add_soport_time', function (event) {

            \$.ajax({
                url: '{{ url('helpassistance_list_help_data') }}',
                dataType: 'json',
                data: {
                    'edit': '1',
                    'process_edit': 3,
                    'insert_asesor':1,
                    'id_soport_time_add':\$('#id_soport_time_add').val(),
                    'id_tiempo_usado_add':\$('#id_tiempo_usado_add').val(),
                    'id_motivo_add':\$('#id_motivo_add').val(),
                    'id_fecha_add':\$('#id_fecha_add').val(),
                    'IdSolicitud':\$('#id_solicitud').val(),
                },
                success: function (response) {
                    
                    var html = '';
                    \$.each(response.help_assistance_time, function (index, key) {
                        var value_help_s = this;
                        html += '<tr>';
                        html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                        html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                        html += '<td>' + value_help_s.nota + '</td>';
                        html += '<td>' + value_help_s.created_at + '</td>';
                        html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                        html += '</tr>';
                    });
                    \$('table#help_time tbody').html(html)
                    
                    alert(\"Datos Registrados\")
                    \$(\"#add_time_empled .close\").click()
                    
                }
            });
        });
        
        \$(document).on('click', '#edit_soport_time', function (event) {
            \$.ajax({
                url: '{{ url('helpassistance_list_help_data') }}',
                dataType: 'json',
                data: {
                    'edit': '1',
                    'process_edit':4,
                    'edit_asesor':1,
                    'id_soport_time_edit':\$('#id_soport_time_edit').val(),
                    'id_tiempo_usado_edit':\$('#id_tiempo_usado_edit').val(),
                    'id_motivo_edit':\$('#id_motivo_edit').val(),
                    'id_fecha_edit':\$('#id_fecha_edit').val(),
                    'IdSolicitud':\$('#id_solicitud').val(),
                },
                success: function (response) {
                    var html = '';



                    \$.each(response.help_assistance_time, function (index, key) {
                        var value_help_s = this;


                        html += '<tr>';
                        html += '<td style=\"overflow: auto;width: 25%\">' + value_help_s.Asesor + '</td>';
                        html += '<td>' + value_help_s.tiempo_trabajado + '</td>';
                        html += '<td>' + value_help_s.nota + '</td>';
                        html += '<td>' + value_help_s.created_at + '</td>';
                        html += '<td><a href=\"#\" class=\"edit\" data-toggle=\"modal\" id=\"edit_time_empled\" data-id_aplicacion_time='+ value_help_s.id_aplicacion_time +'><i class=\"material-icons\" data-toggle=\"tooltip\" title=\"Edit\">&#xE254;</i></a></td>';
                        html += '</tr>';
                    });
                    \$('table#help_time tbody').html(html)

                    alert(\"Datos Editados\");
                    \$(\"#edit_help_timeModal .close\").click();

                }
            });
        });
    </script>

{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script type=\"text/javascript\">

        \$(document).ready(function () {

            \$('#hd_dt_table tfoot th').each(function () {
                var title = \$(this).text();
                if (title.trim() != '') {
                    \$(this).html('<input type=\"hidden\" class=\"\" placeholder=\"Search ' + title + '\" />');
                }
            });

            var table = \$('#hd_dt_table').DataTable({
                stateSave: true,
                \"responsive\": true,
                \"columnDefs\":
                    [
                        // These are the column name variables that will be sent to the server
                        {\"name\": \"id\", \"targets\": 0},
                        {\"name\": \"usuario\", \"targets\": 1},
                        {\"name\": \"descripcion\", \"targets\": 2, \"hideIfEmpty\": true},
                        {\"name\": \"estado\", \"targets\": 3},
                        {\"name\": \"tienda\", \"targets\": 4},
                        {\"name\": \"created_by\", \"targets\": 5},
                        {\"name\": \"created_at\", \"targets\": 6},
                        {
                            \"name\": \"button_id\", \"targets\": 7, \"render\": function (data, type, row) {

                                return \"<button type='button' id='edit_solicitud' \" +
                                    \"class='btn btn-primary btn-sm' data-target='#myModal' data-dismiss='modal'\" +
                                    \"data-backdrop='false'\" +
                                    \"data-id_employees='1'\" +
                                    \"onclick='show_modal(\" + data + \")'>\" +
                                    \"<span class='glyphicon glyphicon-edit' aria-hidden='true'></span>\"
                                    +
                                    \"</button>\";
                            }
                        },
                    ],
                \"processing\": true,
                \"serverSide\": true,
                \"ajax\": {
                    \"url\": \"{{ path('helpassistance_list_help') }}\",
                    \"type\": \"POST\"
                },
                \"paging\": true,
                \"info\": true,
                \"searching\": true,
                \"pageLength\": 10,
                \"order\": [[0, 'desc']]
            });

            table.columns().every(function () {
                var that = this;

                \$('input', this.footer()).on('keyup change clear', function () {
                    if (that.search() !== this.value) {
                        that
                            .search(this.value)
                            .draw();
                    }
                });
            });

            \$('#form_idUserAssigned').change(function () {
                var idUserAssigned = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Usuario') {
                        \$(this).val(idUserAssigned).trigger(\"change\");
                    }
                })
            });
            
            \$('#id_solicitud_s').keyup(function () {

                var id_solicitud_s = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Id') {
                        \$(this).val(id_solicitud_s).trigger(\"change\");
                    }
                })
            });

            \$('#descripcion').keyup(function () {

                var description = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Descripcion') {
                        \$(this).val(description).trigger(\"change\");
                    }
                })
            });

            \$('#form_idEstado').change(function () {
                var idestado = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Estado') {
                        \$(this).val(idestado).trigger(\"change\");
                    }
                })
            });

            \$('#form_idTienda').change(function () {
                var idtienda = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Tienda') {
                        \$(this).val(idtienda).trigger(\"change\");
                    }
                })
            });

            \$('#form_createdBy').change(function () {
                var idcreated_by = \$(this).val();

                \$('#hd_dt_table').find('tfoot input').each(function () {

                    if (\$(this).attr('placeholder') == 'Search Registrado Por') {
                        \$(this).val(idcreated_by).trigger(\"change\");
                    }
                })
            });

            \$('#myModal').on('shown.bs.modal', function () {
                \$(this).before(\$('.modal-backdrop'));
                \$(this).css(\"z-index\", parseInt(\$('.modal-backdrop').css('z-index')) + 1);
            });

            \$('#send_edit_help').click(function () {

                if (\$('#usersoporte_help').val().trim() === '') {
                    alert(\"El campo usuario asignado, no puede estar vacio\");
                    return false
                }

                if (\$('#appbundle_helpassistance_idAplicacionTarea').val().trim() === '') {
                    alert(\"Debe Elegir una aplicacion\");
                    return false
                }

                // if (\$(\"#appbundle_helpassistance_idAplicacionTarea\").val() == undefined ? '' : \$(\"#appbundle_helpassistance_idAplicacionTarea\").val().trim()) {
                //     alert(\"Debe Elegir una Aplicacion\");
                //     return false
                // }

                if (\$('#id_aplicacion_detalle').val().trim() === '') {
                    alert(\"Debe Elegir un Detalle de la aplicacion\");
                    return false
                }

                \$.ajax({
                    url: '{{ url('helpassistance_help_list') }}',
                    dataType: 'json',
                    data: {
                        'id_solicitud': \$('#id_solicitud').val(),
                        'estados': \$('#estados').val(),
                        'nota': \$('#appbundle_helpassistance_nota').val(),
                        'usersoporte_help': \$('#usersoporte_help').val(),
                        'idAplicacionTarea': \$('#appbundle_helpassistance_idAplicacionTarea').val(),
                        'idAplicaciondetalle': \$('#id_aplicacion_detalle').val().replace(/ /g, '%20'),
                        'update': 'update'
                    },
                    success: function (data) {
                        alert(\"Help Actualizado\");
                        window.location.reload()
                    }
                })

            });

            \$('#appbundle_helpassistance_idAplicacionTarea').change(function (evt) {
                evt.preventDefault();
                let aplicacion = \$(this).val();
                document.querySelectorAll('#id_aplicacion_detalle option').forEach(option => option.remove());
                \$.ajax(
                    {
                        url: '{{ url('helpassistance_help_list') }}',
                        dataType: 'json',
                        data: {'id_aplicacion': aplicacion, 'aplicacion': 'aplicacion'},
                        success: function (response) {

                            var retval = [];
                            \$.each(response, function (i, value) {
                                retval.push(value['id']);
                            });

                            retval.forEach(function (item, index) {

                                \$(\"#appbundle_helpassistance_idDetalleAplicacion option\").each(function (i, k) {

                                    var values_op = \$(this).val();

                                    if (item == values_op) {
                                        \$('#id_aplicacion_detalle').append(this).selectpicker();
                                    }
                                });
                            });
                        }
                    })
            });

        });
    </script>
{% endblock %}
", "@App/help/helpassistance/list_help.html.twig", "/home/newcolmoda/public_html/CMDA/src/AppBundle/Resources/views/help/helpassistance/list_help.html.twig");
    }
}
