<?php
session_start();
include('conexion.php');
include('./include/sesiones.php');
if (isset($_SESSION['clie_id'])) { ?>
    <!doctype html>
    <html lang="en" onclick="cerrar();cerrar2()">

    <head>
        <?php

        include('./include/sesiones.php');
        include('include/head.php');
        ?>
        <div id="div_buscador"></div>
        <?php
        include('php_menu/menu_categorias.php');
        include('php_menu/menu_izquierdo.php');
        ?>
    </head>

    <body>
        <section class="main_content_area">
            <div class="container">
                <div class="account_dashboard">
                    <div class="row">
                        <div class="col-sm-12 col-md-12 col-lg-12">
                            <div class="dashboard_tab_button">
                                <ul role="tablist" class="nav flex-line dashboard-list">
                                    <li><a href="#cuenta_detalles" data-bs-toggle="tab" class="nav-link active">Cuenta</a></li>
                                    <li> <a href="#pedidos" data-bs-toggle="tab" class="nav-link">Pedidos</a></li>


                                    <?php if ($negocio_neg_id == '5') { ?>
                                        <li> <a href="#Reservas" data-bs-toggle="tab" class="nav-link">Reservas</a></li>

                                         <?php }   ?>

                                    <!--<li> <a href="#Reservas_hotel" data-bs-toggle="tab" class="nav-link">Reservas HOTEL</a></li>
                                    <li> <a href="#Reservas_cancha" data-bs-toggle="tab" class="nav-link">Reservas CANCHAS</a></li>-->
                                    <li> <a href="#factura" data-bs-toggle="tab" class="nav-link">Facturas</a></li>
                                    <?php $sql1 = mysqli_query($con, "SELECT * FROM cliente where clie_id='$clie_id' and empresa='$emp_id' ") or die(mysqli_error($con));
                                    $cli = mysqli_fetch_array($sql1);
                                    $clie_credito = $cli['clie_credito'];
                                    if ($clie_credito == '1') {  ?>
                                        <li> <a href="#cartera" data-bs-toggle="tab" class="nav-link">Creditos</a></li>
                                    <?php } ?>
                                    <?php $datos = mysqli_query($con, "SELECT * FROM tarifas where tar_id='$tarifas_tar_id'");
                                    $fila = mysqli_fetch_array($datos);
                                    $tar_nombre = $fila['tar_nombre'];
                                    if ($tar_nombre == 'ASESOR') { ?>
                                        <li> <a href="https://vicpos.com/cotizador" target="_blank" class="nav-link">Cotizador</a></li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-12 col-lg-12">
                            <div class="tab-content dashboard_content">
                                <div class="tab-pane fade active" id="cuenta_detalles">
                                    <h3>Detalles de Cuenta</h3>
                                    <div class="account_form">
                                        <div class="outer_div_cuenta"></div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="pedidos">
                                    <h3>Tus Pedidos</h3>
                                    <div class="account_form">
                                        <div class="outer_div_pedido"></div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="Reservas">
                                    <h3>Tus Reservas</h3>
                                    <div class="account_form">
                                        <div class="outer_div_reservas"></div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="factura">
                                    <h3>Tus Facturas</h3>
                                    <div class="col-md-12">
                                        <input class="form-control" type="text" id="q" placeholder="Buscador N° Factura" onKeyUp='load(1);' autofocus />
                                    </div>
                                    <div class="account_form">
                                        <div class="outer_div"></div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="cartera">
                                    <h3>Tus Creditos</h3>
                                    <div class="account_form">
                                        <div>
                                            <?php include('./php_cuenta/tabla_cxc.php'); ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </body>


    <?php include('include/footer.php') ?>
    <script src="assets/js/plugins.js"></script>
    <script src="assets/js/main.js"></script>
    <script type="text/javascript" src="../php_ventas/ajax.js"></script>

    <script src="assets/js/reservas.js"></script>
    <script type="text/javascript">
        function buscador() {
            $.get("./php_menu/buscador.php", "", function(data) {
                $("#div_buscador").html(data);
            })
        }
        buscador();


        function recargarLista() {
            $.ajax({
                type: "POST",
                url: "php_cuenta/ciudades.php",
                data: "id=" + $('#departamento').val(),
                success: function(r) {
                    $('#ciudad').html(r);
                }
            });
        }
        /*

                $(document).ready(function() {
                    load5(1);
                });

                function load5(page) {
                    $('.outer_div_reservas_cancha').html('');
                    $.ajax({
                        url: "./php_cuenta/tabla_reservas_cancha.php",
                        method: "GET",
                        data: {
                            page: page
                        },
                        success: function(data) {
                            $('.outer_div_reservas_cancha').html(data);
                        }
                    });
                }




                $(document).ready(function() {
                    load4(1);
                });

                function load4(page) {
                    $('.outer_div_reservas_hotel').html('');
                    $.ajax({
                        url: "./php_cuenta/tabla_reserva_hotel.php",
                        method: "GET",
                        data: {
                            page: page
                        },
                        success: function(data) {
                            $('.outer_div_reservas_hotel').html(data);
                        }
                    });
                }




        */




        $(document).ready(function() {
            load3(1);
        });

        function load3(page) {
            $('.outer_div_reservas').html('');
            $.ajax({
                url: "./php_cuenta/tabla_reservas.php",
                method: "GET",
                data: {
                    page: page
                },
                success: function(data) {
                    $('.outer_div_reservas').html(data);
                }
            });
        }








        $(document).ready(function() {
            load2(1);
        });

        function load2(page) {
            $('.outer_div_cuenta').html('');
            $.ajax({
                url: "./php_cuenta/form_detalle_cuenta.php",
                method: "GET",
                data: {
                    page: page
                },
                success: function(data) {
                    $('.outer_div_cuenta').html(data);
                }
            });
        }


        $(document).ready(function() {
            load1(1);
        });

        function load1(page) {
            $('.outer_div_pedido').html('');
            $.ajax({
                url: "./php_cuenta/tabla_pedidos.php",
                method: "GET",
                data: {
                    page: page
                },
                success: function(data) {
                    $('.outer_div_pedido').html(data);
                }
            });
        }



        $(document).ready(function() {
            load(1);
        });


        function load(page) {
            var q = $("#q").val();
            $('.outer_div').html('');
            $.ajax({
                url: "./php_cuenta/tabla_facturas.php",
                method: "GET",
                data: {
                    page: page,
                    q: q
                },
                success: function(data) {
                    $('.outer_div').html(data);
                }
            });
        }




        function loadTurno() {

            $.get("php_cuenta/tabla_reservas.php", "", function(data) {
                $("#turno").html(data);
            })
        }
        loadTurno();
    </script>


<?php
} else {
    header('Location: index.php');
}
?>