<?php
include "../../pidbco/pidbjoin.php";

if(!isset($_SESSION))
{
    session_start();
}


if(!isset($_SESSION['jay_proj_mngmnt']) && empty($_SESSION['jay_proj_mngmnt']))
{
    echo '<script type="text/javascript">alert("You Want To Login Now.."); window.location.href="../Login";</script>';
}

include "../ses_write.php";
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Marketing</title>

    <!-- Bootstrap core CSS -->

    <link href="../components/css/bootstrap.min.css" rel="stylesheet">

    <link href="../components/fonts/css/font-awesome.min.css" rel="stylesheet">
    <link href="../components/css/animate.min.css" rel="stylesheet">

    <!-- Custom styling plus plugins -->
    <link href="../components/css/custom.css" rel="stylesheet">
    <link href="../components/css/icheck/flat/green.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../components/css/maps/jquery-jvectormap-2.0.1.css" />
    <link href="../components/css/floatexamples.css" rel="stylesheet" type="text/css" />


    <script src="../components/js/jquery.min.js"></script>
    <script src="../components/js/nprogress.js"></script>
    <script>
        NProgress.start();
    </script>

    <style>
        input[type=number] {
            -moz-appearance:textfield;
        }

        input[type=number]::-webkit-inner-spin-button,
        input[type=number]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
    </style>


    <!--[if lt IE 9]>
    <script src="../assets/js/ie8-responsive-file-warning.js"></script>
    <![endif]-->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- DataTables CSS -->
    <link href="../components/data_table/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">

    <!-- DataTables Responsive CSS -->
    <link href="../components/data_table/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">

    <!-- select2 -->
    <link href="../components/css/select/select2.min.css" rel="stylesheet">



</head>


<body class="nav-md">

<div class="container body">


<div class="main_container">

<?php include("left_menu.php"); ?>

<!-- top navigation -->
<?php include("top_nav.php"); ?>
<!-- /top navigation -->

<script type="text/javascript">
    $(document).ready(function () {
        $('#est_date').daterangepicker({
            singleDatePicker: true,
            calender_style: "picker_4"
        }, function (start, end, label) {
            console.log(start.toISOString(), end.toISOString(), label);
        });
    });
</script>

<!-- New Order with Exst Client --->

<script>
    function edit_new_ord_exst_cst_data(edt2)
    {
        $.ajax({
            url   :"ajax_new_ord_exst_cust.php" ,
            type  : "POST",
            data  :
            {
                btn_show_edt_form_exst_cst_data     : 1,
                edt2                                : edt2

            },
            success:function(res211)
            {
                $('#form_data_02').html(res211);
            }
        });
    }
</script>

<script>
    function exst_cst_amt_type_chng(ctype)
    {
        if(ctype == 2)
        {
            $.ajax({
                url   :"ajax_new_ord_exst_cust.php" ,
                type  : "POST",
                data  :
                {
                    btn_show_type_wse_exst_cst_data   : 1,
                    ctype                             : ctype
                },
                success:function(res212)
                {
                    $('#cst_chq_data').html(res212);
                }
            });
        }
        else
        {
            $('#cst_chq_data').html("");
        }
    }
</script>

<script>
function save_next_exst_cst_data()
{
    var ck_disc = /^[A-Za-z .,0-9 ]/;
    var ck_num = /^[0-9 ]/;
    var ck_email = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i



    //Product
    if(document.getElementById('cst_pro_cat').value == "")
    {
        alert("Please Enter  Product");
        $('#cst_pro_cat').focus();
        return false;
    }
    if(document.getElementById('cst_pro_cat').value.match(ck_num))
    {

    }
    else
    {
        alert('Miss Match Error Product..!');
        $('#cst_pro_cat').focus();
        return false;
    }

    //source
    if(document.getElementById('cst_source').value == "")
    {
        alert("Please Enter  source");
        $('#cst_source').focus();
        return false;
    }
    if(document.getElementById('cst_source').value.match(ck_disc))
    {

    }
    else
    {
        alert('Miss Match Error source..!');
        $('#cst_source').focus();
        return false;
    }

    //domain
    if(document.getElementById('cst_domain').value != "")
    {
        if(document.getElementById('cst_domain').value.match(ck_disc))
        {

        }
        else
        {
            alert('Miss Match Error domain..!');
            $('#cst_domain').focus();
            return false;
        }
    }

    //qtn_no
    if(document.getElementById('cst_qtn_no').value != "")
    {
        if(document.getElementById('cst_qtn_no').value.match(ck_disc))
        {

        }
        else
        {
            alert('Miss Match Error Qtn no..!');
            $('#cst_qtn_no').focus();
            return false;
        }
    }

    //bdo
    if(document.getElementById('cst_bdo').value == "")
    {
        alert("Please Enter  bdo");
        $('#cst_bdo').focus();
        return false;
    }
    if(document.getElementById('cst_bdo').value.match(ck_num))
    {

    }
    else
    {
        alert('Miss Match Error bdo..!');
        $('#cst_bdo').focus();
        return false;
    }

    //est_date
    if(document.getElementById('cst_est_date').value == "")
    {
        alert("Please Enter  Order date");
        $('#cst_est_date').focus();
        return false;
    }

    //ord_amt
    if(document.getElementById('cst_ord_amt').value == "")
    {
        alert("Please Enter  Order Amount");
        $('#cst_ord_amt').focus();
        return false;
    }
    if(document.getElementById('cst_ord_amt').value.match(ck_num))
    {

    }
    else
    {
        alert('Miss Match Error Order Amount..!');
        $('#cst_ord_amt').focus();
        return false;
    }

    //adv_amt
    if(document.getElementById('cst_adv_amt').value == "")
    {
        alert("Please Enter  Advance Amount");
        $('#cst_adv_amt').focus();
        return false;
    }
    if(document.getElementById('cst_adv_amt').value.match(ck_num))
    {

    }
    else
    {
        alert('Miss Match Error Advance Amount..!');
        $('#cst_adv_amt').focus();
        return false;
    }

    //order_det
    if(document.getElementById('cst_order_det').value == "")
    {
        alert("Please Enter  Order Details");
        $('#cst_order_det').focus();
        return false;
    }
    if(document.getElementById('cst_order_det').value.match(ck_disc))
    {

    }
    else
    {
        alert('Miss Match Error Order Details..!');
        $('#cst_order_det').focus();
        return false;
    }

    //amt_type
    if(document.getElementById('cst_amt_type').value == "")
    {
        alert("Please Enter  Amount Type");
        $('#cst_amt_type').focus();
        return false;
    }
    if(document.getElementById('cst_amt_type').value.match(ck_num))
    {

    }
    else
    {
        alert('Miss Match Error Amount Type..!');
        $('#cst_amt_type').focus();
        return false;
    }


    if(document.getElementById('csd').value == "")
    {
        alert("Error");
        return false;
    }


    var csd = $('#csd').val();
    var cst_pro_cat = $('#cst_pro_cat').val();
    var cst_domain = $('#cst_domain').val();
    var cst_qtn_no = $('#cst_qtn_no').val();
    var cst_source = $('#cst_source').val();
    var cst_bdo = $('#cst_bdo').val();
    var cst_est_date = $('#cst_est_date').val();
    var cst_ord_amt = $('#cst_ord_amt').val();
    var cst_adv_amt = $('#cst_adv_amt').val();
    var cst_amt_type = $('#cst_amt_type').val();
    var cst_chq_no = $('#cst_chq_no').val();
    var cst_chq_dt = $('#cst_chq_dt').val();
    var cst_order_det = $('#cst_order_det').val();

    $.ajax({
        url   :"ajax_new_ord_exst_cust.php" ,
        type  : "POST",
        data  :
        {
            btn_reg_data_exst_cst         : 1,
            csd                           : csd,
            cst_pro_cat                   : cst_pro_cat,
            cst_domain                    : cst_domain,
            cst_qtn_no                    : cst_qtn_no,
            cst_source                    : cst_source,
            cst_bdo                       : cst_bdo,
            cst_est_date                  : cst_est_date,
            cst_ord_amt                   : cst_ord_amt,
            cst_adv_amt                   : cst_adv_amt,
            cst_amt_type                  : cst_amt_type,
            cst_chq_no                    : cst_chq_no,
            cst_chq_dt                    : cst_chq_dt,
            cst_order_det                 : cst_order_det


        },
        success:function(res22)
        {
            $('#alert').html(res22);
        }
    });

}
</script>
<script>
    function upld_materials_exst_cst(exst_cst_ord)
    {
        $.ajax({
            url   :"ajax_new_ord_exst_cust.php" ,
            type  : "POST",
            data  :
            {
                btn_upld_data_exst_cst     : 1,
                exst_cst_ord               : exst_cst_ord

            },
            success:function(res223)
            {
                $('#form_data_02').html(res223);
            }
        });
    }
</script>
<!-- page content -->
<div class="right_col" role="main">
<div id="alert"></div>
<div class="col-md-12">

<div class="row">


<!-- CONTENTS -->

        <div class="row">
            <div id="alerts"></div>
            <!-- REGISTER SECTION -->
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>Order Details <small>Register</small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content" id="form_data_02">




                    </div>
                </div>
            </div>
            <!-- END REGISTER SECTION -->
        </div>


        <div class="row">
            <!-- VIEW SECTION -->
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>Our Clients Details<small>View</small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li>
                                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li>
                                <a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content" id="show_data">
                        <div class="dataTables_wrapper">
                            <table class="table table-striped table-bordered table-hover table-responsive" id="dataTables-example">
                                <thead>
                                <tr>
                                    <!--<th>#</th>-->
                                    <th>ID</th>
                                    <th>Company</th>
                                    <th class="hidden-xs">Person</th>
                                    <th>Phone</th>
                                    <th class="hidden-xs">location</th>
                                    <th class="hidden-xs">email</th>
                                    <th>Status</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                $stmt = mysqli_query($con,"SELECT * FROM customers_det ORDER BY id DESC ");
                                //$i=1;
                                while($res = mysqli_fetch_object($stmt))
                                {

                                    ?>
                                    <tr class="odd gradeX" onclick="edit_new_ord_exst_cst_data(<?php echo $res->id; ?>)" title="Create Order" style="cursor: pointer;">
                                        <!--<td></td>-->
                                        <td><?php echo $res->id; ?></td>
                                        <td><?php echo $res->company_name; ?></td>
                                        <td class="hidden-xs"><?php echo $res->contact_person; ?></td>
                                        <td><?php echo $qry15_fet->mob1; ?></td>
                                        <td class="hidden-xs"><?php echo $res->loc; ?></td>
                                        <td class="hidden-xs"><?php echo $res->email; ?></td>
                                        <td class="center"><?php if($res->status == 1){ echo 'Active'; }elseif($res->status == 2){ echo 'In-Active'; }  ?></td>
                                    </tr>
                                    <?php
                                    //$i++;
                                }
                                $stmt->close();
                                ?>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                </div>
            </div>
            <!-- END VIEW SECTION -->
        </div>

<!-- END CONTENTS -->
</div>

</div>

</div>
<!-- /page content -->

</div>
</div>

<div id="custom_notifications" class="custom-notifications dsp_none">
    <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
    </ul>
    <div class="clearfix"></div>
    <div id="notif-group" class="tabbed_notifications"></div>
</div>

<script src="../components/js/bootstrap.min.js"></script>


<!-- bootstrap progress js -->
<script src="../components/js/progressbar/bootstrap-progressbar.min.js"></script>
<script src="../components/js/nicescroll/jquery.nicescroll.min.js"></script>
<!-- icheck -->
<script src="../components/js/icheck/icheck.min.js"></script>
<!-- tags -->
<script src="../components/js/tags/jquery.tagsinput.min.js"></script>
<!-- switchery -->
<script src="../components/js/switchery/switchery.min.js"></script>
<!-- daterangepicker -->
<script type="text/javascript" src="../components/js/moment.min2.js"></script>
<script type="text/javascript" src="../components/js/datepicker/daterangepicker.js"></script>

<script src="../components/js/custom.js"></script>

<!-- DataTables JavaScript -->
<script src="../components/data_table/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="../components/data_table/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script>
    $(document).ready(function() {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>


<!-- select2 -->
<script src="../components/js/select/select2.full.js"></script>
<script>
    $(document).ready(function () {
        $(".country").select2({
            placeholder: "Select a Country",
            allowClear: true
        });
        $(".state").select2({
            placeholder: "Select a State",
            allowClear: true
        });
        $(".district").select2({
            placeholder: "Select a district",
            allowClear: true
        });
        $(".bdo").select2({
            placeholder: "Select a Telecaller (BDO)",
            allowClear: true
        });
    });
</script>
<!-- /select2 -->

</body>

</html>
