<?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/TimeClock/timeclock_create.html.twig */
class __TwigTemplate_f62d75204cea9ad2f39f259926c3772c0566cf7a42d2885dbb7729b8179483f9 extends \Twig\Template
{
    public function __construct(Environment $env)
    {
        parent::__construct($env);

        // line 1
        $this->parent = $this->loadTemplate("@App/Layouts/layout.html.twig", "@App/TimeClock/timeclock_create.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/TimeClock/timeclock_create.html.twig"));

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

    }

    // line 3
    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 4
        echo "    <link href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css\" rel=\"stylesheet\" id=\"bootstrap-css\">
    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/UAParser.js/0.7.12/ua-parser.min.js\"></script>

    <style type=\"text/css\">
        .sidebar1 {
            padding: 0;
            min-height: 100%;
        }

        .main-content {
            text-align: center;
        }

        #calendar_schedule {
            max-width: 600px;
            margin: 0 auto;
        }

        #overlay{
            position: fixed;
            top: 0;
            z-index: 100;
            width: 100%;
            height:100%;
            display: none;
            background: rgba(0,0,0,0.6);
        }
        .cv-spinner {
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 50%;
            margin: 0 auto;
        }
        .spinner {
            width: 40px;
            height: 40px;
            border: 4px #ddd solid;
            border-top: 4px #2e93e6 solid;
            border-radius: 50%;
            animation: sp-anime 0.8s infinite linear;
        }
        @keyframes sp-anime {
            100% {
                transform: rotate(360deg);
            }
        }
        .wickedpicker {
            z-index: 1650 ;
        }
    </style>

    <div class=\"container-fluid\">
        <div class=\"row\">
            <div class=\"col-md-2 col-sm-4 sidebar1\">
                <div>
                    <img src=\"";
        // line 61
        echo twig_escape_filter($this->env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\AssetExtension')->getAssetUrl("uploads/logo.png"), "html", null, true);
        echo "\" class=\"img-responsive center-block\" alt=\"Logo\">
                </div>
                <div class=\"container\">
                    <form id=\"form\" method=\"post\">
                        <div class=\"row\">
                            <div class=\"col-xs-3 col-sm-3 col-md-3\">
                                <div class=\"form-group\">
                                    ";
        // line 68
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "empfullname", []), 'label', ["label" => "Name"]);
        echo "
                                    ";
        // line 69
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "empfullname", []), 'widget');
        echo "
                                </div>
                            </div>
                        </div>
                        <div class=\"row\">
                            <div class=\"col-xs-3 col-sm-3 col-md-3\">
                                <div class=\"form-group\">
                                    ";
        // line 76
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "employeePasswd", []), 'label', ["label" => "Password"]);
        echo "
                                    ";
        // line 77
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "employeePasswd", []), 'widget');
        echo "
                                </div>
                            </div>
                        </div>
                        <div class=\"row\">
                            <div class=\"col-md-offset-1\">
                                <div class=\"form-group\">
                                    <a class=\"btn btn-primary\" id=\"submittime\">Entrar</a>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class=\"col-md-10 col-sm-8 main-content\">
                <div class=\"container\">
                    <div id=\"tabla_resultado\">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type=\"hidden\" value=\"";
        // line 99
        echo twig_escape_filter($this->env, (isset($context["get_ipaddress"]) ? $context["get_ipaddress"] : $this->getContext($context, "get_ipaddress")), "html", null, true);
        echo "\" id=\"get_ipaddress\">
    <input type=\"hidden\" value=\"";
        // line 100
        echo twig_escape_filter($this->env, (isset($context["device"]) ? $context["device"] : $this->getContext($context, "device")), "html", null, true);
        echo "\" id=\"device\">

    <div class=\"modal fplist-closeade\" data-refresh=\"true\" id=\"miModal\" role=\"dialog\"
         aria-labelledby=\"myModalLabel\">
        <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\">Horario <strong><span id=\"nameimployees\"></span></strong></h4>
                </div>

                <div class=\"modal-body\">
                    <div class=\"doctor-detail-wrap\">
                        <div id=\"calendar_schedule\"></div>
                    </div>
                </div>

                <div class=\"modal-footer\">
                    <button type=\"button\" class=\"btn btn-default\" id=\"calendar-close\" data-dismiss=\"modal\">Close
                    </button>
                </div>
            </div>
        </div>
    </div>
    
    <div id=\"overlay\">
        <div class=\"cv-spinner\">
            <span class=\"spinner\"></span>
        </div>
    </div>
    
    <div id=\"out\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myLargeModalLabel\" aria-hidden=\"true\">
        <div class=\"modal-dialog\">
            <div class=\"modal-content\">
                <div class=\"modal-header\">
                    <h4 class=\"modal-title\" id=\"memberModalLabel\">Registros de estado Dia anterior</h4>
                </div>
                <div class=\"modal-body\">
                    <div id=\"list_yesterday\"></div>
                </div>
                <div class=\"modal-footer\">
                    <button type=\"button\" class=\"btn btn-warning\" id=\"timepicker_register\">Registrar</button>
                    <button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\">Close</button>
                </div>
            </div>
        </div>
    </div>

";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

    // line 149
    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 150
        echo "    ";
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "
    <script type=\"text/javascript\">

        \$(document).ready(function () {
            \$(\"#backendbundle_employees_empfullname\").change(function () {
                var selectedemployees = \$(this).children(\"option:selected\").val();

                \$.ajax(
                    {
                        url: '";
        // line 159
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_index");
        echo "',
                        data: {'employees': selectedemployees},
                        dataType: 'json',
                    }
                )
                    .done(function (data) {

                        let difftime = JSON.parse(data.difftime);
                        let emplo = JSON.parse(data.emplo);

                        if (emplo === 3) {
                            document.getElementById(\"backendbundle_employees_employeePasswd\").disabled = true;
                            alert(\"En estos momentos tu cuenta esta bloqueada \" + \"Intenta dentro de \" + difftime);
                            window.location.reload()
                        }
                    })
            });

            \$('#backendbundle_employees_employeePasswd').keypress(function (e) {
                if (e.which == 13) {
                    \$('#submittime').click();
                    return false;
                }
            });

            if (\$('#backendbundle_employees_empfullname').focus().select()) {
                var user_cmda = localStorage.getItem(\"user_cmda\");
                \$('#backendbundle_employees_empfullname').val(user_cmda)
            }

        });

        \$(document).on('click', '#submittime', function () {
            let pass_employee = \$('#backendbundle_employees_employeePasswd').val();
            let employeselect = \$('#backendbundle_employees_empfullname').val();
            let emplofullname = \$(\"#backendbundle_employees_empfullname option:selected\").text();

            if (pass_employee == null || pass_employee == '' && !employeselect == null || !employeselect == '') {
                \$.ajax(
                    {
                        url: '";
        // line 199
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_listemployee");
        echo "',
                        data:
                            {
                                'employeselect': employeselect,
                                'emplofullname': emplofullname,
                                'employepassword': pass_employee
                            },
                        dataType: 'json',
                    })
                    .done(function (data) {
                        if (data.hasOwnProperty(\"response\") && data.response === \"success\") {
                            let employees = JSON.parse(data.employees);
                            let pass = JSON.parse(data.datasvalidation);
                            let empfullname = JSON.parse(data.empfullname);
                            let employeePasswd = JSON.parse(data.employeePasswd);
                            let id_employee = JSON.parse(data.id_employee);
                            let states = JSON.parse(data.states);
                            let option_states = JSON.parse(data.option_states);
                            let option_state = JSON.parse(data.states_out);
                            let liststatesyesterday = JSON.parse(data.liststatesyesterday);
                            
                            
                            if (option_state == 1) {

                                \$('#list_yesterday').html(liststatesyesterday);
                                \$('#out').modal({backdrop: 'static', keyboard: false, open});
                                \$(\"#out\").css(\"z-index\", \"1500\");
                            }
                            

                            let state = {};
                            let dates_states = {};

                            if (states.length === 0) {
                                state = 'No Tiene Estado'.toUpperCase();
                            } else {
                                for (var i = 0; i < states.length; i++) {
                                    state = states[i]['inout'].toUpperCase();

                                    var beginDate = new Date(states[i].times);
                                    dates_states = beginDate.toLocaleString('default', { year: 'numeric', month: 'long', day: 'numeric' });
                                }
                            }

                            let statepass = '';
                            let employeselectval = '';
                            var count_user = 0;

                            for (passw in pass) {

                                if (count_user++ == 1) {

                                    if (pass['empfullname'] === empfullname && pass['employeePasswd'] === employeePasswd) {

                                        if (localStorage.getItem(\"user_cmda\") == null || localStorage.getItem(\"user_cmda\") != employeselect) {
                                            if (confirm('Deseas Guardar tu usuario en el Navegador')) {
                                                localStorage.setItem(\"user_cmda\", employeselect);
                                            }
                                        }

                                        var html = \"\";
                                        html += '<table class=\"table\" id=\"mytable\">';
                                        html += '<thead>';
                                        html += '<tr>';
                                        html += '<th colspan=\"3\">';
                                        html += '<button type=\"button\" id=\"schedule\" data-users=\"' + id_employee + '\" data-employees=\"' + empfullname + '\" class=\"btn btn-info\">Ver horario asignado';
                                        html += '</button';
                                        html += '</th>';
                                        html += '</tr>';
                                        html += '<tr>';
                                        html += '<th>Name</th>';
                                        html += '<th>Time</th>';
                                        html += '<th>In/out</th>';
                                        html += '</tr>';
                                        html += '</thead>';
                                        html += '<tbody>';

                                        for (i = 0; i < employees.length; i++) {
                                            let emplo = employees[i];
                                            
                                            if (emplo['inout'] == 'out') 
                                            {
                                                emplo['inout'] = 'Fin de la Jornada';
                                            }
                                            
                                            if (emplo['inout'] == 'in') 
                                            {
                                                emplo['inout'] = 'Entrada';
                                            }
                                            
                                            if (emplo['inout'] == 'break') 
                                            {
                                                emplo['inout'] = 'Salida Descanso Corto';
                                            }
                                        
                                            if (emplo['inout'] == 'lunch') 
                                            {
                                                emplo['inout'] = 'Salida Almuerzo';
                                            }

                                            html += '<tr>';
                                            html += '<td>' + emplo['empfullname'] + '</td>';
                                            html += '<td>' + emplo['time'] + '</td>';
                                            html += '<td style=\"background-color: ' + emplo['color'] + '\">' + emplo['inout'] + '</td>';
                                            html += '</tr>';
                                        }

                                        html += '</tbody>';
                                        html += '</table>';

                                        html += '<div class=\"row\">';
                                        html += '<div class=\"col-md-10 col-xs-8 alert alert-info\" style=\"padding: 60px !important;margin: 0 auto;left: 10%\">';
                                        html += '<p style=\"font-size: 30px;font-weight: bold;margin: 0 auto;\">Ultimo Estado</p>';
                                        html += '<strong style=\"font-size: 30px\">' + state +\" \"+ dates_states  + '</strong>';
                                        html += '';
                                        html += '</div>';
                                        html += '</div>';

                                        html += '<br>';
                                        html += '<br>';

                                        html += '<div class=\"row\">';
                                        html += '<div class=\"col-xs-12\">';
                                        html += '<div style=\"width:200px;margin: 0 auto;\" id=\"option_register\">';

                                        html += '";
        // line 324
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "tstamp", []), 'label', ["label" => "In/Out:"]);
        echo "';
                                        html += '<select id=\"backendbundle_employees_tstamp\" class=\"form-control\">';
                                        html += '<option></option>';

                                        for (var t = 0; t < option_states.length; t++) {
                                            var statess = option_states[t];
                                            html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                        }

                                        html += '</select>';

                                        \$.ajax(
                                            {
                                                method: 'POST',
                                                url: '";
        // line 338
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_create");
        echo "',
                                                data: {id_employee: id_employee},
                                            }).
                                        done(function (data) {
                                            let datas = JSON.parse(data.state);
                                            for (var idata = 0; idata < datas.length; ++idata) {
                                                let laststate = datas[idata];
                                                
                                                if (laststate['inout'] == 'break') {
                                                    \$('#backendbundle_employees_tstamp option[value=\"2\"]').attr(\"selected\", \"selected\").text('INGRESA DE BREAK');

                                                    \$(\"#backendbundle_employees_tstamp\").each(function () {
                                                        \$(this).find('option').not(':selected').remove();
                                                    })
                                                } else {
                                                    html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                                }

                                                if (laststate['inout'] == 'lunch') {
                                                    \$('#backendbundle_employees_tstamp option[value=\"2\"]').attr(\"selected\", \"selected\").text('INGRESA DE LUNCH');

                                                    \$(\"#backendbundle_employees_tstamp\").each(function () {
                                                        \$(this).find('option').not(':selected').remove();
                                                    })
                                                } else {
                                                    html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                                }
                                            }
                                        });

                                        html += '";
        // line 368
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "office", []), 'label', ["label" => "Notes"]);
        echo "';
                                        html += '";
        // line 369
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\FormExtension')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "office", []), 'widget');
        echo "';

                                        html += '<br>';

                                        html += '<button class=\"btn btn-primary\" id=\"register\" role=\"button\" onclick=\"\">Ingresar</button>';

                                        html += '</div>';
                                        html += '</div>';
                                        html += '</div>';

                                        statepass = true;
                                        employeselectval = employeselect;
                                    } else {
                                        \$('#tabla_resultado').html('');
                                        statepass = false;
                                        employeselectval = employeselect;
                                        window.location.reload();
                                    }

                                    \$('#tabla_resultado').html(html);
                                    getTable_result();
                                }

                                if (statepass === false) {
                                    \$.ajax
                                    (
                                        {
                                            url: '";
        // line 396
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_attempt_index");
        echo "',
                                            data: {'idEmployee': employeselectval, 'attempt': 0},
                                            dataType: 'json',
                                            success: function (data) {
                                            }
                                        }
                                    );

                                    alert(\"Datos invalidos\")
                                } else if (statepass === true) {
                                    \$.ajax
                                    (
                                        {
                                            url: '";
        // line 409
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_attempt_index");
        echo "',
                                            data: {'idEmployee': employeselectval, 'attempt': 1},
                                            dataType: 'json',
                                            success: function (data) {
                                            }
                                        }
                                    );

                                }
                            }
                        }
                    })
            } else {
                console.log('Ingrese Datos');
            }
        });

        var validate_register = 1;

        \$(document).on('click', '#register', function () {
            let register = validate_register++;
            var a = document.getElementById('backendbundle_employees_tstamp').value;

            if (register == 1)
            {
                if (!a == null || !a == \"\") {
                    let employempfullname = document.getElementById('backendbundle_employees_empfullname');
                    var optfullname = employempfullname.options[employempfullname.selectedIndex];
                    let empfullname = optfullname.text;
                    let id_employee = optfullname.value;

                    let employeePasswd = \$('#backendbundle_employees_employeePasswd').val();

                    let pouninout = document.getElementById('backendbundle_employees_tstamp');
                    var optinout = pouninout.options[pouninout.selectedIndex];
                    let inout = optinout.text;
                    
                    if (inout == 'Salida Descanso Corto') {
                        inout = 'break';
                    }

                    if (inout == 'Salida Almuerzo') {
                        inout = 'lunch';
                    }

                    if (inout == 'Fin de la Jornada') {
                        inout = 'out';
                    }

                    if (inout == 'INGRESA DE BREAK' || inout == 'INGRESA DE LUNCH') {
                        inout = 'in';
                    }

                    let notes = \$('#backendbundle_employees_office').val();

                    let get_ipaddress = \$('#get_ipaddress').val();

                    var parser = new UAParser();

                    var userOs = parser.getOS();
                    var userBrowser = parser.getBrowser();

                    let os = userOs.name + ' ' + userOs.version;
                    let browser = userBrowser.name + ' ' + userBrowser.version;
                    let screen_resolu = window.screen.width + 'x' + window.screen.height;

                    let device = \$('#device').val();

                    \$.ajax(
                        {
                            method: 'POST',
                            url: '";
        // line 480
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_create");
        echo "',
                            data:
                                {
                                    id_employee: id_employee,
                                    empfullname: empfullname,
                                    employeePasswd: employeePasswd,
                                    inout: inout,
                                    notes: notes,
                                    get_ipaddress: get_ipaddress,
                                    os: os,
                                    browser: browser,
                                    screen_resolu: screen_resolu,
                                    device: device
                                },
                            dataType: 'json',
                            beforeSend:function () {
                                \$('#option_register *').prop('disabled',true);
                                \$(\"#overlay\").fadeIn(300);
                            }
                        })
                        .done(function (resultado) {
                            \$(\"#overlay\").fadeOut(300);
                            if (resultado.hasOwnProperty(\"response\") && resultado.response === \"success\") {
                                alert(\"Registro exitoso\");
                                let datas = JSON.parse(JSON.stringify(resultado));
                                window.location.reload();
                                // console.log(datas)
                            }
                        });
                } else {
                    alert(\"Ingresa, El estado para el empleado\");
                }
            }

        });

        function getvalTstamp(sel) {
            let id_employee = \$('#backendbundle_employees_empfullname').val();
            let selectionstate = sel.options[sel.selectedIndex].innerHTML;

            \$.ajax(
                {
                    method: 'POST',
                    url: '";
        // line 523
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_create");
        echo "',
                    data: {id_employee: id_employee},
                }).done(function (data) {

                let datas = JSON.parse(data.state);

                for (var i = 0; i < datas.length; ++i) {
                    let laststate = datas[i];

                    if (selectionstate == laststate['inout']) {
                        alert(\"No puedes seleccionar la misma opcion, En la cual estas registrado\");
                        document.ready = document.getElementById(\"backendbundle_employees_tstamp\").value = '';
                    }
                }
            });
        }

        \$(document).on('click', '#schedule', function () {

            \$('#calendar_schedule').fullCalendar('destroy');

            let date = new Date();
            let yyyy = date.getFullYear().toString();
            let mm = (date.getMonth() + 1).toString().length == 1 ? \"0\" + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString();
            let dd = (date.getDate()).toString().length == 1 ? \"0\" + (date.getDate()).toString() : (date.getDate()).toString();
            let id_employ = \$(this).data('users');
            \$('#nameimployees').text(\$(this).data(\"employees\"));

            \$('#calendar_schedule').fullCalendar({
                theme: true,
                header:
                    {
                        language: 'es',
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,basicWeek'
                    },
                defaultDate: yyyy + \"-\" + mm + \"-\" + dd,
                editable: true,
                eventLimit: true,
                selectable: true,
                selectHelper: true,
                displayEventTime: false,

                events: function (start, end, timezone, callback) {
                    \$.ajax({
                        url: '";
        // line 569
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_employeegroupaedicion");
        echo "',
                        dataType: 'json',
                        data: {'id_employ': id_employ},
                        async: false,
                        success: function (doc) {
                            var events = [];
                            let emplot = JSON.parse(doc.employeetime);

                            \$.map(emplot, function (r) {
                                events.push(
                                    {
                                        title: r.hourIn + ' a ' + r.hourOut,
                                        start: r.start_date,
                                        id: {'hourIn': r.hourIn, 'hourOut': r.hourOut, 'start_date': r.start_date}
                                    });
                            });
                            callback(events);
                        },
                    });
                },
            });

            \$(\"#miModal\").modal(open).show();
            \$(\"#miModal\").css(\"z-index\", \"1500\");

        });

        \$(document).ready(function () {
            \$('#miModal').on('shown.bs.modal', function () {
                \$(\"#calendar_schedule\").fullCalendar('render');
            });
            
            \$('.timepicker-12-hr-clearable').wickedpicker({clearable: true});
            
        });
        
        \$(document).on('click', '#timepicker_register', function () {


            \$('#yesterday tr td input.timepicker-12-hr-clearable').each(function () {

                let state = \$(this).data(\"state\");
                var t = \$(this).val().toString();
                var time = t.replace(' : ', ' ');
                var h = (time.split(' ')[0]);
                var m = time.split(' ')[1];
                var ampm = time.split(' ')[2];
                
                if (ampm == 'AM')
                {
                   var am = parseInt(1);
                   
                }else if (ampm == 'PM') 
                {
                   var pm = parseInt(2);
                }
                
   
                
                let id_employee = \$('#backendbundle_employees_empfullname').val();
                let employee_name = \$('#backendbundle_employees_empfullname option:selected').text();

                \$.ajax(
                    {
                        url: '";
        // line 633
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("timeclock_validatestate_out");
        echo "',
                        data: {
                            'h': h,
                            'm': m,
                            'am':am,
                            'pm':pm,
                            'id_employee': id_employee, 'employee_name': employee_name,'state':state},
                    }
                )
                    .done(function (data) {
                        
                        console.log(data)
                    });
                alert('Datos Registrados');
                \$('#out').modal('toggle');
                window.location.reload()
            });

        });
        
        function getTable_result() {
           \$('#mytable tbody tr td').each(function () {

               if (\$(this).html() == 'Salida Descanso Corto')
               {
                   var color_break = \$(this).css(\"background-color\");

                   \$(this).parent().next().find('td').each(function () {

                       if (\$(this).html() == 'Entrada')
                       {
                           \$(this).html('Entrada Descanso Corto').css('background-color', color_break);
                       }
                   })
               }

               if (\$(this).html() == 'Salida Almuerzo')
               {
                   var color_lunch = \$(this).css(\"background-color\");

                   \$(this).parent().next().find('td').each(function () {

                       if (\$(this).html() == 'Entrada')
                       {
                           \$(this).html('Entrada Almuerzo').css('background-color', color_lunch);
                       }
                   })
               }

           });
           
           \$('#backendbundle_employees_tstamp').find('option').map(function () {

               if (\$(this).val() == 1)
               {
                   \$(this).text('Salida Descanso Corto')
               }

               if (\$(this).val() == 3)
               {
                   \$(this).text('Salida Almuerzo')
               }

               if (\$(this).val() == 4)
               {
                   \$(this).text('Fin de la Jornada')
               }

           })
           
           \$(function() {
                var \$target = \$(\"#backendbundle_employees_tstamp\");
                var \$clone = \$target.clone().removeAttr('id');
                \$clone.val(\$target.val()).css({
                    overflow: \"auto\",
                    position: 'absolute',
                    'z-index': 999,
                    left: \$target.offset().left,
                    top: \$target.offset().top + \$target.outerHeight(),
                    width: \$target.outerWidth()
                }).attr('size', \$clone.find('option').length > 10 ? 10 : \$clone.find('option').length).change(function() {
                    \$target.val(\$clone.val());
                }).on('click blur keypress',function(e) {
                    if(e.type !== \"keypress\" || e.which === 13)
                        \$(this).remove();
                });
                \$('body').append(\$clone);
                \$clone.focus();
            })
            
            \$('#yesterday tr td input.timepicker-12-hr-clearable').each(function () {
                \$(this).wickedpicker({clearable: true});
            })

        }

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

    }

    public function getTemplateName()
    {
        return "@App/TimeClock/timeclock_create.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  750 => 633,  683 => 569,  634 => 523,  588 => 480,  514 => 409,  498 => 396,  468 => 369,  464 => 368,  431 => 338,  414 => 324,  286 => 199,  243 => 159,  230 => 150,  224 => 149,  168 => 100,  164 => 99,  139 => 77,  135 => 76,  125 => 69,  121 => 68,  111 => 61,  52 => 4,  46 => 3,  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\">
    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/UAParser.js/0.7.12/ua-parser.min.js\"></script>

    <style type=\"text/css\">
        .sidebar1 {
            padding: 0;
            min-height: 100%;
        }

        .main-content {
            text-align: center;
        }

        #calendar_schedule {
            max-width: 600px;
            margin: 0 auto;
        }

        #overlay{
            position: fixed;
            top: 0;
            z-index: 100;
            width: 100%;
            height:100%;
            display: none;
            background: rgba(0,0,0,0.6);
        }
        .cv-spinner {
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 50%;
            margin: 0 auto;
        }
        .spinner {
            width: 40px;
            height: 40px;
            border: 4px #ddd solid;
            border-top: 4px #2e93e6 solid;
            border-radius: 50%;
            animation: sp-anime 0.8s infinite linear;
        }
        @keyframes sp-anime {
            100% {
                transform: rotate(360deg);
            }
        }
        .wickedpicker {
            z-index: 1650 ;
        }
    </style>

    <div class=\"container-fluid\">
        <div class=\"row\">
            <div class=\"col-md-2 col-sm-4 sidebar1\">
                <div>
                    <img src=\"{{ asset('uploads/logo.png') }}\" class=\"img-responsive center-block\" alt=\"Logo\">
                </div>
                <div class=\"container\">
                    <form id=\"form\" method=\"post\">
                        <div class=\"row\">
                            <div class=\"col-xs-3 col-sm-3 col-md-3\">
                                <div class=\"form-group\">
                                    {{ form_label(form.empfullname,'Name') }}
                                    {{ form_widget(form.empfullname) }}
                                </div>
                            </div>
                        </div>
                        <div class=\"row\">
                            <div class=\"col-xs-3 col-sm-3 col-md-3\">
                                <div class=\"form-group\">
                                    {{ form_label(form.employeePasswd,'Password') }}
                                    {{ form_widget(form.employeePasswd) }}
                                </div>
                            </div>
                        </div>
                        <div class=\"row\">
                            <div class=\"col-md-offset-1\">
                                <div class=\"form-group\">
                                    <a class=\"btn btn-primary\" id=\"submittime\">Entrar</a>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class=\"col-md-10 col-sm-8 main-content\">
                <div class=\"container\">
                    <div id=\"tabla_resultado\">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type=\"hidden\" value=\"{{ get_ipaddress }}\" id=\"get_ipaddress\">
    <input type=\"hidden\" value=\"{{ device }}\" id=\"device\">

    <div class=\"modal fplist-closeade\" data-refresh=\"true\" id=\"miModal\" role=\"dialog\"
         aria-labelledby=\"myModalLabel\">
        <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\">Horario <strong><span id=\"nameimployees\"></span></strong></h4>
                </div>

                <div class=\"modal-body\">
                    <div class=\"doctor-detail-wrap\">
                        <div id=\"calendar_schedule\"></div>
                    </div>
                </div>

                <div class=\"modal-footer\">
                    <button type=\"button\" class=\"btn btn-default\" id=\"calendar-close\" data-dismiss=\"modal\">Close
                    </button>
                </div>
            </div>
        </div>
    </div>
    
    <div id=\"overlay\">
        <div class=\"cv-spinner\">
            <span class=\"spinner\"></span>
        </div>
    </div>
    
    <div id=\"out\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myLargeModalLabel\" aria-hidden=\"true\">
        <div class=\"modal-dialog\">
            <div class=\"modal-content\">
                <div class=\"modal-header\">
                    <h4 class=\"modal-title\" id=\"memberModalLabel\">Registros de estado Dia anterior</h4>
                </div>
                <div class=\"modal-body\">
                    <div id=\"list_yesterday\"></div>
                </div>
                <div class=\"modal-footer\">
                    <button type=\"button\" class=\"btn btn-warning\" id=\"timepicker_register\">Registrar</button>
                    <button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\">Close</button>
                </div>
            </div>
        </div>
    </div>

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

        \$(document).ready(function () {
            \$(\"#backendbundle_employees_empfullname\").change(function () {
                var selectedemployees = \$(this).children(\"option:selected\").val();

                \$.ajax(
                    {
                        url: '{{ url('timeclock_index') }}',
                        data: {'employees': selectedemployees},
                        dataType: 'json',
                    }
                )
                    .done(function (data) {

                        let difftime = JSON.parse(data.difftime);
                        let emplo = JSON.parse(data.emplo);

                        if (emplo === 3) {
                            document.getElementById(\"backendbundle_employees_employeePasswd\").disabled = true;
                            alert(\"En estos momentos tu cuenta esta bloqueada \" + \"Intenta dentro de \" + difftime);
                            window.location.reload()
                        }
                    })
            });

            \$('#backendbundle_employees_employeePasswd').keypress(function (e) {
                if (e.which == 13) {
                    \$('#submittime').click();
                    return false;
                }
            });

            if (\$('#backendbundle_employees_empfullname').focus().select()) {
                var user_cmda = localStorage.getItem(\"user_cmda\");
                \$('#backendbundle_employees_empfullname').val(user_cmda)
            }

        });

        \$(document).on('click', '#submittime', function () {
            let pass_employee = \$('#backendbundle_employees_employeePasswd').val();
            let employeselect = \$('#backendbundle_employees_empfullname').val();
            let emplofullname = \$(\"#backendbundle_employees_empfullname option:selected\").text();

            if (pass_employee == null || pass_employee == '' && !employeselect == null || !employeselect == '') {
                \$.ajax(
                    {
                        url: '{{ url('timeclock_listemployee') }}',
                        data:
                            {
                                'employeselect': employeselect,
                                'emplofullname': emplofullname,
                                'employepassword': pass_employee
                            },
                        dataType: 'json',
                    })
                    .done(function (data) {
                        if (data.hasOwnProperty(\"response\") && data.response === \"success\") {
                            let employees = JSON.parse(data.employees);
                            let pass = JSON.parse(data.datasvalidation);
                            let empfullname = JSON.parse(data.empfullname);
                            let employeePasswd = JSON.parse(data.employeePasswd);
                            let id_employee = JSON.parse(data.id_employee);
                            let states = JSON.parse(data.states);
                            let option_states = JSON.parse(data.option_states);
                            let option_state = JSON.parse(data.states_out);
                            let liststatesyesterday = JSON.parse(data.liststatesyesterday);
                            
                            
                            if (option_state == 1) {

                                \$('#list_yesterday').html(liststatesyesterday);
                                \$('#out').modal({backdrop: 'static', keyboard: false, open});
                                \$(\"#out\").css(\"z-index\", \"1500\");
                            }
                            

                            let state = {};
                            let dates_states = {};

                            if (states.length === 0) {
                                state = 'No Tiene Estado'.toUpperCase();
                            } else {
                                for (var i = 0; i < states.length; i++) {
                                    state = states[i]['inout'].toUpperCase();

                                    var beginDate = new Date(states[i].times);
                                    dates_states = beginDate.toLocaleString('default', { year: 'numeric', month: 'long', day: 'numeric' });
                                }
                            }

                            let statepass = '';
                            let employeselectval = '';
                            var count_user = 0;

                            for (passw in pass) {

                                if (count_user++ == 1) {

                                    if (pass['empfullname'] === empfullname && pass['employeePasswd'] === employeePasswd) {

                                        if (localStorage.getItem(\"user_cmda\") == null || localStorage.getItem(\"user_cmda\") != employeselect) {
                                            if (confirm('Deseas Guardar tu usuario en el Navegador')) {
                                                localStorage.setItem(\"user_cmda\", employeselect);
                                            }
                                        }

                                        var html = \"\";
                                        html += '<table class=\"table\" id=\"mytable\">';
                                        html += '<thead>';
                                        html += '<tr>';
                                        html += '<th colspan=\"3\">';
                                        html += '<button type=\"button\" id=\"schedule\" data-users=\"' + id_employee + '\" data-employees=\"' + empfullname + '\" class=\"btn btn-info\">Ver horario asignado';
                                        html += '</button';
                                        html += '</th>';
                                        html += '</tr>';
                                        html += '<tr>';
                                        html += '<th>Name</th>';
                                        html += '<th>Time</th>';
                                        html += '<th>In/out</th>';
                                        html += '</tr>';
                                        html += '</thead>';
                                        html += '<tbody>';

                                        for (i = 0; i < employees.length; i++) {
                                            let emplo = employees[i];
                                            
                                            if (emplo['inout'] == 'out') 
                                            {
                                                emplo['inout'] = 'Fin de la Jornada';
                                            }
                                            
                                            if (emplo['inout'] == 'in') 
                                            {
                                                emplo['inout'] = 'Entrada';
                                            }
                                            
                                            if (emplo['inout'] == 'break') 
                                            {
                                                emplo['inout'] = 'Salida Descanso Corto';
                                            }
                                        
                                            if (emplo['inout'] == 'lunch') 
                                            {
                                                emplo['inout'] = 'Salida Almuerzo';
                                            }

                                            html += '<tr>';
                                            html += '<td>' + emplo['empfullname'] + '</td>';
                                            html += '<td>' + emplo['time'] + '</td>';
                                            html += '<td style=\"background-color: ' + emplo['color'] + '\">' + emplo['inout'] + '</td>';
                                            html += '</tr>';
                                        }

                                        html += '</tbody>';
                                        html += '</table>';

                                        html += '<div class=\"row\">';
                                        html += '<div class=\"col-md-10 col-xs-8 alert alert-info\" style=\"padding: 60px !important;margin: 0 auto;left: 10%\">';
                                        html += '<p style=\"font-size: 30px;font-weight: bold;margin: 0 auto;\">Ultimo Estado</p>';
                                        html += '<strong style=\"font-size: 30px\">' + state +\" \"+ dates_states  + '</strong>';
                                        html += '';
                                        html += '</div>';
                                        html += '</div>';

                                        html += '<br>';
                                        html += '<br>';

                                        html += '<div class=\"row\">';
                                        html += '<div class=\"col-xs-12\">';
                                        html += '<div style=\"width:200px;margin: 0 auto;\" id=\"option_register\">';

                                        html += '{{ form_label(form.tstamp,\"In/Out:\") }}';
                                        html += '<select id=\"backendbundle_employees_tstamp\" class=\"form-control\">';
                                        html += '<option></option>';

                                        for (var t = 0; t < option_states.length; t++) {
                                            var statess = option_states[t];
                                            html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                        }

                                        html += '</select>';

                                        \$.ajax(
                                            {
                                                method: 'POST',
                                                url: '{{ url('timeclock_create') }}',
                                                data: {id_employee: id_employee},
                                            }).
                                        done(function (data) {
                                            let datas = JSON.parse(data.state);
                                            for (var idata = 0; idata < datas.length; ++idata) {
                                                let laststate = datas[idata];
                                                
                                                if (laststate['inout'] == 'break') {
                                                    \$('#backendbundle_employees_tstamp option[value=\"2\"]').attr(\"selected\", \"selected\").text('INGRESA DE BREAK');

                                                    \$(\"#backendbundle_employees_tstamp\").each(function () {
                                                        \$(this).find('option').not(':selected').remove();
                                                    })
                                                } else {
                                                    html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                                }

                                                if (laststate['inout'] == 'lunch') {
                                                    \$('#backendbundle_employees_tstamp option[value=\"2\"]').attr(\"selected\", \"selected\").text('INGRESA DE LUNCH');

                                                    \$(\"#backendbundle_employees_tstamp\").each(function () {
                                                        \$(this).find('option').not(':selected').remove();
                                                    })
                                                } else {
                                                    html += '<option value=\"' + statess.id_punchlist + '\">' + statess.punchitems + '</option>';
                                                }
                                            }
                                        });

                                        html += '{{ form_label(form.office,'Notes') }}';
                                        html += '{{ form_widget(form.office) }}';

                                        html += '<br>';

                                        html += '<button class=\"btn btn-primary\" id=\"register\" role=\"button\" onclick=\"\">Ingresar</button>';

                                        html += '</div>';
                                        html += '</div>';
                                        html += '</div>';

                                        statepass = true;
                                        employeselectval = employeselect;
                                    } else {
                                        \$('#tabla_resultado').html('');
                                        statepass = false;
                                        employeselectval = employeselect;
                                        window.location.reload();
                                    }

                                    \$('#tabla_resultado').html(html);
                                    getTable_result();
                                }

                                if (statepass === false) {
                                    \$.ajax
                                    (
                                        {
                                            url: '{{ url('timeclock_attempt_index') }}',
                                            data: {'idEmployee': employeselectval, 'attempt': 0},
                                            dataType: 'json',
                                            success: function (data) {
                                            }
                                        }
                                    );

                                    alert(\"Datos invalidos\")
                                } else if (statepass === true) {
                                    \$.ajax
                                    (
                                        {
                                            url: '{{ url('timeclock_attempt_index') }}',
                                            data: {'idEmployee': employeselectval, 'attempt': 1},
                                            dataType: 'json',
                                            success: function (data) {
                                            }
                                        }
                                    );

                                }
                            }
                        }
                    })
            } else {
                console.log('Ingrese Datos');
            }
        });

        var validate_register = 1;

        \$(document).on('click', '#register', function () {
            let register = validate_register++;
            var a = document.getElementById('backendbundle_employees_tstamp').value;

            if (register == 1)
            {
                if (!a == null || !a == \"\") {
                    let employempfullname = document.getElementById('backendbundle_employees_empfullname');
                    var optfullname = employempfullname.options[employempfullname.selectedIndex];
                    let empfullname = optfullname.text;
                    let id_employee = optfullname.value;

                    let employeePasswd = \$('#backendbundle_employees_employeePasswd').val();

                    let pouninout = document.getElementById('backendbundle_employees_tstamp');
                    var optinout = pouninout.options[pouninout.selectedIndex];
                    let inout = optinout.text;
                    
                    if (inout == 'Salida Descanso Corto') {
                        inout = 'break';
                    }

                    if (inout == 'Salida Almuerzo') {
                        inout = 'lunch';
                    }

                    if (inout == 'Fin de la Jornada') {
                        inout = 'out';
                    }

                    if (inout == 'INGRESA DE BREAK' || inout == 'INGRESA DE LUNCH') {
                        inout = 'in';
                    }

                    let notes = \$('#backendbundle_employees_office').val();

                    let get_ipaddress = \$('#get_ipaddress').val();

                    var parser = new UAParser();

                    var userOs = parser.getOS();
                    var userBrowser = parser.getBrowser();

                    let os = userOs.name + ' ' + userOs.version;
                    let browser = userBrowser.name + ' ' + userBrowser.version;
                    let screen_resolu = window.screen.width + 'x' + window.screen.height;

                    let device = \$('#device').val();

                    \$.ajax(
                        {
                            method: 'POST',
                            url: '{{ url('timeclock_create') }}',
                            data:
                                {
                                    id_employee: id_employee,
                                    empfullname: empfullname,
                                    employeePasswd: employeePasswd,
                                    inout: inout,
                                    notes: notes,
                                    get_ipaddress: get_ipaddress,
                                    os: os,
                                    browser: browser,
                                    screen_resolu: screen_resolu,
                                    device: device
                                },
                            dataType: 'json',
                            beforeSend:function () {
                                \$('#option_register *').prop('disabled',true);
                                \$(\"#overlay\").fadeIn(300);
                            }
                        })
                        .done(function (resultado) {
                            \$(\"#overlay\").fadeOut(300);
                            if (resultado.hasOwnProperty(\"response\") && resultado.response === \"success\") {
                                alert(\"Registro exitoso\");
                                let datas = JSON.parse(JSON.stringify(resultado));
                                window.location.reload();
                                // console.log(datas)
                            }
                        });
                } else {
                    alert(\"Ingresa, El estado para el empleado\");
                }
            }

        });

        function getvalTstamp(sel) {
            let id_employee = \$('#backendbundle_employees_empfullname').val();
            let selectionstate = sel.options[sel.selectedIndex].innerHTML;

            \$.ajax(
                {
                    method: 'POST',
                    url: '{{ url('timeclock_create') }}',
                    data: {id_employee: id_employee},
                }).done(function (data) {

                let datas = JSON.parse(data.state);

                for (var i = 0; i < datas.length; ++i) {
                    let laststate = datas[i];

                    if (selectionstate == laststate['inout']) {
                        alert(\"No puedes seleccionar la misma opcion, En la cual estas registrado\");
                        document.ready = document.getElementById(\"backendbundle_employees_tstamp\").value = '';
                    }
                }
            });
        }

        \$(document).on('click', '#schedule', function () {

            \$('#calendar_schedule').fullCalendar('destroy');

            let date = new Date();
            let yyyy = date.getFullYear().toString();
            let mm = (date.getMonth() + 1).toString().length == 1 ? \"0\" + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString();
            let dd = (date.getDate()).toString().length == 1 ? \"0\" + (date.getDate()).toString() : (date.getDate()).toString();
            let id_employ = \$(this).data('users');
            \$('#nameimployees').text(\$(this).data(\"employees\"));

            \$('#calendar_schedule').fullCalendar({
                theme: true,
                header:
                    {
                        language: 'es',
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,basicWeek'
                    },
                defaultDate: yyyy + \"-\" + mm + \"-\" + dd,
                editable: true,
                eventLimit: true,
                selectable: true,
                selectHelper: true,
                displayEventTime: false,

                events: function (start, end, timezone, callback) {
                    \$.ajax({
                        url: '{{ url('timeclock_employeegroupaedicion') }}',
                        dataType: 'json',
                        data: {'id_employ': id_employ},
                        async: false,
                        success: function (doc) {
                            var events = [];
                            let emplot = JSON.parse(doc.employeetime);

                            \$.map(emplot, function (r) {
                                events.push(
                                    {
                                        title: r.hourIn + ' a ' + r.hourOut,
                                        start: r.start_date,
                                        id: {'hourIn': r.hourIn, 'hourOut': r.hourOut, 'start_date': r.start_date}
                                    });
                            });
                            callback(events);
                        },
                    });
                },
            });

            \$(\"#miModal\").modal(open).show();
            \$(\"#miModal\").css(\"z-index\", \"1500\");

        });

        \$(document).ready(function () {
            \$('#miModal').on('shown.bs.modal', function () {
                \$(\"#calendar_schedule\").fullCalendar('render');
            });
            
            \$('.timepicker-12-hr-clearable').wickedpicker({clearable: true});
            
        });
        
        \$(document).on('click', '#timepicker_register', function () {


            \$('#yesterday tr td input.timepicker-12-hr-clearable').each(function () {

                let state = \$(this).data(\"state\");
                var t = \$(this).val().toString();
                var time = t.replace(' : ', ' ');
                var h = (time.split(' ')[0]);
                var m = time.split(' ')[1];
                var ampm = time.split(' ')[2];
                
                if (ampm == 'AM')
                {
                   var am = parseInt(1);
                   
                }else if (ampm == 'PM') 
                {
                   var pm = parseInt(2);
                }
                
   
                
                let id_employee = \$('#backendbundle_employees_empfullname').val();
                let employee_name = \$('#backendbundle_employees_empfullname option:selected').text();

                \$.ajax(
                    {
                        url: '{{ url('timeclock_validatestate_out') }}',
                        data: {
                            'h': h,
                            'm': m,
                            'am':am,
                            'pm':pm,
                            'id_employee': id_employee, 'employee_name': employee_name,'state':state},
                    }
                )
                    .done(function (data) {
                        
                        console.log(data)
                    });
                alert('Datos Registrados');
                \$('#out').modal('toggle');
                window.location.reload()
            });

        });
        
        function getTable_result() {
           \$('#mytable tbody tr td').each(function () {

               if (\$(this).html() == 'Salida Descanso Corto')
               {
                   var color_break = \$(this).css(\"background-color\");

                   \$(this).parent().next().find('td').each(function () {

                       if (\$(this).html() == 'Entrada')
                       {
                           \$(this).html('Entrada Descanso Corto').css('background-color', color_break);
                       }
                   })
               }

               if (\$(this).html() == 'Salida Almuerzo')
               {
                   var color_lunch = \$(this).css(\"background-color\");

                   \$(this).parent().next().find('td').each(function () {

                       if (\$(this).html() == 'Entrada')
                       {
                           \$(this).html('Entrada Almuerzo').css('background-color', color_lunch);
                       }
                   })
               }

           });
           
           \$('#backendbundle_employees_tstamp').find('option').map(function () {

               if (\$(this).val() == 1)
               {
                   \$(this).text('Salida Descanso Corto')
               }

               if (\$(this).val() == 3)
               {
                   \$(this).text('Salida Almuerzo')
               }

               if (\$(this).val() == 4)
               {
                   \$(this).text('Fin de la Jornada')
               }

           })
           
           \$(function() {
                var \$target = \$(\"#backendbundle_employees_tstamp\");
                var \$clone = \$target.clone().removeAttr('id');
                \$clone.val(\$target.val()).css({
                    overflow: \"auto\",
                    position: 'absolute',
                    'z-index': 999,
                    left: \$target.offset().left,
                    top: \$target.offset().top + \$target.outerHeight(),
                    width: \$target.outerWidth()
                }).attr('size', \$clone.find('option').length > 10 ? 10 : \$clone.find('option').length).change(function() {
                    \$target.val(\$clone.val());
                }).on('click blur keypress',function(e) {
                    if(e.type !== \"keypress\" || e.which === 13)
                        \$(this).remove();
                });
                \$('body').append(\$clone);
                \$clone.focus();
            })
            
            \$('#yesterday tr td input.timepicker-12-hr-clearable').each(function () {
                \$(this).wickedpicker({clearable: true});
            })

        }

    </script>
{% endblock %}", "@App/TimeClock/timeclock_create.html.twig", "/home/ponchamdc/public_html/cmda/src/AppBundle/Resources/views/TimeClock/timeclock_create.html.twig");
    }
}
