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

        // line 1
        $this->parent = $this->loadTemplate("@App/Layouts/layout.html.twig", "@App/saldo/saldo_list.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/saldo/saldo_list.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 "    <div class=\"container\">
        <div class=\"row\">
            <div class=\"col-sm-6 col-sm-offset-3\">
                <h4>Crear Saldo a Favor</h4>
            </div>

            <div class=\"col-sm-3 col-sm-offset-3\">
                <div class=\"form-group has-feedback\">
                    <label for=\"search\" class=\"sr-only\">Search</label>
                    <input type=\"text\" class=\"form-control\" name=\"search\" id=\"search\" placeholder=\"search\"
                           onkeyup=\"\">
                    <span class=\"glyphicon glyphicon-search form-control-feedback\"></span>
                </div>
            </div>
        </div>

        <div id=\"tabla_resultado\">

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

    }

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

        function obtener_registros(clientes) {
            \$.ajax(
                {
                    method: 'GET',
                    url: '";
        // line 34
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("saldoshow");
        echo "',
                    data: {cliente: clientes},
                    dataType: 'json',
                    complete: function () {
                        setTimeout(function () {
                            document.getElementById(\"search\").value = \"\";
                        }, 10000);

                    },
                    error: function (jqXHR, exception) {
                        if (jqXHR.status === 500) {
                            alert('error. del sistema')
                        }
                    }
                })

                .done(function (resultado) {
                    if (resultado.hasOwnProperty(\"response\") && resultado.response === \"success\") {
                        if (resultado.hasOwnProperty(\"cliente\")) {
                            let clientes = JSON.parse(resultado.cliente);

                            if (clientes.length > 0) {
                                var html = \"\";
                                for (clie in clientes) {
                                    html += '<div class=\"container\">';
                                    html += '<form class=\"form-horizontal\" id=\"formClient\">';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">ID:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"id_cliente\" value=\"' + clientes[clie][\"idCliente\"] + '\" name=\"id_cliente\" readonly>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">NOMBRE:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"nom_cliente\" value=\"' + clientes[clie][\"nombre\"] + '\" name=\"nom_cliente\" disabled>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">APELLIDO:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"ape_cliente\" value=\"' + clientes[clie][\"apellido\"] + '\" name=\"ape_cliente\" disabled>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">VALOR:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"number\" pattern=\"^[0-9]+\" min=\"0\" class=\"form-control\" id=\"valor\" value=\"\" placeholder=\"Ingrese value\" name=\"valor\" >';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">MOTIVO:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<textarea class=\"form-control\" rows=\"5\" name=\"motivo\" placeholder=\"Ingrese el motivo por el cual asignara este credito a favor\" id=\"motivo\"></textarea>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<div class=\"col-sm-offset-2 col-sm-10\">';
                                    html += '<button type=\"button\" id=\"submit\" class=\"btn btn-primary\">Submit</button>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '</form>';
                                    html += '</div>';
                                }
                                \$('#tabla_resultado').html(html)

                            } else {
                                // alert('Cliente no se Encuentra')
                            }
                        }
                    }
                })
        }

        \$(document).on('keyup', '#search', function () {
            let valorBusqueda = \$(this).val();
            if (valorBusqueda != '') {
                obtener_registros(valorBusqueda)
            } else {
                obtener_registros()
            }
        });

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

           if (\$('#valor').val().length  === 0)
           {
               alert('dato requerido para campo valor');
           }else if (\$('#motivo').val().length === 0)
           {
               alert('dato requerido para campo motivo');
           }else {
               let cli_saldo = \$('#formClient').serialize();
               // console.log(cli_saldo);
               \$.post('";
        // line 128
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getUrl("saldocreate");
        echo "', cli_saldo, function (data,status) {
                   if (status === 'success')
                   {
                       swal('',data)
                           .then((value) => {
                               window.location = '";
        // line 133
        echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("saldolist");
        echo "';
                           });
                   }
               });
           }
        });
    </script>
";
        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

    }

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

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  202 => 133,  194 => 128,  97 => 34,  85 => 26,  79 => 25,  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 %}
    <div class=\"container\">
        <div class=\"row\">
            <div class=\"col-sm-6 col-sm-offset-3\">
                <h4>Crear Saldo a Favor</h4>
            </div>

            <div class=\"col-sm-3 col-sm-offset-3\">
                <div class=\"form-group has-feedback\">
                    <label for=\"search\" class=\"sr-only\">Search</label>
                    <input type=\"text\" class=\"form-control\" name=\"search\" id=\"search\" placeholder=\"search\"
                           onkeyup=\"\">
                    <span class=\"glyphicon glyphicon-search form-control-feedback\"></span>
                </div>
            </div>
        </div>

        <div id=\"tabla_resultado\">

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

        function obtener_registros(clientes) {
            \$.ajax(
                {
                    method: 'GET',
                    url: '{{ url('saldoshow') }}',
                    data: {cliente: clientes},
                    dataType: 'json',
                    complete: function () {
                        setTimeout(function () {
                            document.getElementById(\"search\").value = \"\";
                        }, 10000);

                    },
                    error: function (jqXHR, exception) {
                        if (jqXHR.status === 500) {
                            alert('error. del sistema')
                        }
                    }
                })

                .done(function (resultado) {
                    if (resultado.hasOwnProperty(\"response\") && resultado.response === \"success\") {
                        if (resultado.hasOwnProperty(\"cliente\")) {
                            let clientes = JSON.parse(resultado.cliente);

                            if (clientes.length > 0) {
                                var html = \"\";
                                for (clie in clientes) {
                                    html += '<div class=\"container\">';
                                    html += '<form class=\"form-horizontal\" id=\"formClient\">';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">ID:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"id_cliente\" value=\"' + clientes[clie][\"idCliente\"] + '\" name=\"id_cliente\" readonly>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">NOMBRE:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"nom_cliente\" value=\"' + clientes[clie][\"nombre\"] + '\" name=\"nom_cliente\" disabled>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">APELLIDO:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"text\" class=\"form-control\" id=\"ape_cliente\" value=\"' + clientes[clie][\"apellido\"] + '\" name=\"ape_cliente\" disabled>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">VALOR:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<input type=\"number\" pattern=\"^[0-9]+\" min=\"0\" class=\"form-control\" id=\"valor\" value=\"\" placeholder=\"Ingrese value\" name=\"valor\" >';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<label class=\"control-label col-sm-2\" for=\"email\">MOTIVO:</label>';
                                    html += '<div class=\"col-sm-5\">';
                                    html += '<textarea class=\"form-control\" rows=\"5\" name=\"motivo\" placeholder=\"Ingrese el motivo por el cual asignara este credito a favor\" id=\"motivo\"></textarea>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '<div class=\"form-group\">';
                                    html += '<div class=\"col-sm-offset-2 col-sm-10\">';
                                    html += '<button type=\"button\" id=\"submit\" class=\"btn btn-primary\">Submit</button>';
                                    html += '</div>';
                                    html += '</div>';
                                    html += '</form>';
                                    html += '</div>';
                                }
                                \$('#tabla_resultado').html(html)

                            } else {
                                // alert('Cliente no se Encuentra')
                            }
                        }
                    }
                })
        }

        \$(document).on('keyup', '#search', function () {
            let valorBusqueda = \$(this).val();
            if (valorBusqueda != '') {
                obtener_registros(valorBusqueda)
            } else {
                obtener_registros()
            }
        });

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

           if (\$('#valor').val().length  === 0)
           {
               alert('dato requerido para campo valor');
           }else if (\$('#motivo').val().length === 0)
           {
               alert('dato requerido para campo motivo');
           }else {
               let cli_saldo = \$('#formClient').serialize();
               // console.log(cli_saldo);
               \$.post('{{ url('saldocreate') }}', cli_saldo, function (data,status) {
                   if (status === 'success')
                   {
                       swal('',data)
                           .then((value) => {
                               window.location = '{{ path('saldolist') }}';
                           });
                   }
               });
           }
        });
    </script>
{% endblock %}
", "@App/saldo/saldo_list.html.twig", "/home/colmoda/public_html/CMDA/src/AppBundle/Resources/views/saldo/saldo_list.html.twig");
    }
}
