<?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 --->
<script>
    function edit_new_ord_data(edt)
    {

        $.ajax({
            url   :"ajax_new_ord_page.php" ,
            type  : "POST",
            data  :
            {
                btn_show_edt_form_data     : 1,
                edt                        : edt

            },
            success:function(res111)
            {
                $('#form_data').html(res111);
            }
        });

    }
</script>
<script>
    function amt_type_chng(type)
    {
        if(type == 2)
        {
            $.ajax({
                url   :"ajax_new_ord_page.php" ,
                type  : "POST",
                data  :
                {
                    btn_show_type_wse_data : 1,
                    type                    : type
                },
                success:function(res112)
                {
                    $('#chq_data').html(res112);
                }
            });
        }
        else
        {
            $('#chq_data').html("");
        }

    }
</script>
<script>
function save_next_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

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

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

    //phone2
    if(document.getElementById('phone2').value != "")
    {

        if(document.getElementById('phone2').value.match(ck_num))
        {

        }
        else
        {
            alert('Miss Match Error Second Phone Number..!');
            $('#phone2').focus();
            return false;
        }

    }

    //email
    if(document.getElementById('email').value != "")
    {
        if(document.getElementById('email').value.match(ck_email))
        {

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

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

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

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

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

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

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

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

    }
    else
    {
        alert('Miss Match Error Person Name..!');
        $('#contact_person').focus();
        return false;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    var phone1 = $('#phone1').val();
    var phone2 = $('#phone2').val();
    var email = $('#email').val();
    var address_line1 = $('#address_line1').val();
    var address_line2 = $('#address_line2').val();
    var td = $('#td').val();
    var company = $('#company').val();
    var contact_person = $('#contact_person').val();
    var designation = $('#designation').val();
    var country = $('#country').val();
    var state = $('#state').val();
    var district = $('#district').val();
    var location = $('#location').val();
    var pro_cat = $('#pro_cat').val();
    var domain = $('#domain').val();
    var qtn_no = $('#qtn_no').val();
    var source = $('#source').val();
    var bdo = $('#bdo').val();
    var est_date = $('#est_date').val();
    var ord_amt = $('#ord_amt').val();
    var adv_amt = $('#adv_amt').val();
    var amt_type = $('#amt_type').val();
    var chq_no = $('#chq_no').val();
    var chq_dt = $('#chq_dt').val();
    var order_det = $('#order_det').val();

    $.ajax({
        url   :"ajax_new_ord_page.php" ,
        type  : "POST",
        data  :
        {
            btn_reg_data              : 1,
            phone1                    : phone1,
            phone2                    : phone2,
            email                     : email,
            address_line1             : address_line1,
            address_line2             : address_line2,
            td                        : td,
            company                   : company,
            contact_person            : contact_person,
            designation               : designation,
            country                   : country,
            state                     : state,
            district                  : district,
            location                  : location,
            pro_cat                   : pro_cat,
            domain                    : domain,
            qtn_no                    : qtn_no,
            source                    : source,
            bdo                       : bdo,
            est_date                  : est_date,
            ord_amt                   : ord_amt,
            adv_amt                   : adv_amt,
            amt_type                  : amt_type,
            chq_no                    : chq_no,
            chq_dt                    : chq_dt,
            order_det                 : order_det

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

}
</script>
<script>
    function upld_materials(ord)
    {
        $.ajax({
            url   :"ajax_new_ord_page.php" ,
            type  : "POST",
            data  :
            {
                btn_upld_data              : 1,
                ord                        : ord

            },
            success:function(res123)
            {
                $('#form_data').html(res123);
            }
        });
    }
</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">




                    </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>Confirmed Telecall 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>Exe. BDO</th>
                                    <th class="hidden-xs">Phone</th>
                                    <th class="hidden-xs">Follow Up</th>
                                    <th>Exe. Status</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                $stmt = mysqli_query($con,"SELECT * FROM tele_calls_det WHERE executive_status='5' AND cust_or_not != '1' ORDER BY id DESC ");
                                //$i=1;
                                while($res = mysqli_fetch_object($stmt))
                                {
                                    $ex_bdo = $res->executive_bdo;
                                    $qry15 = mysqli_query($con,"SELECT id,emp_name FROM employee_registration WHERE id='$ex_bdo'");
                                    $qry15_fet = mysqli_fetch_object($qry15);
                                    ?>
                                    <tr class="odd gradeX" onclick="edit_new_ord_data(<?php echo $res->id; ?>)" title="Create Order" style="cursor: pointer;">
                                        <!--<td></td>-->
                                        <td><?php echo $res->id; ?></td>
                                        <td><?php echo $res->comp_name; ?></td>
                                        <td class="hidden-xs"><?php echo $res->person_name; ?></td>
                                        <td><?php echo $qry15_fet->emp_name; ?></td>
                                        <td class="hidden-xs"><?php echo $res->phone; ?></td>
                                        <td class="hidden-xs"><?php echo $res->executive_follow_up; ?></td>
                                        <td class="center"><?php if($res->executive_status == 1){ echo 'Interested'; }elseif($res->executive_status == 2){ echo 'Order Lost'; }elseif($res->executive_status == 5){ echo 'Order Confirmed'; }elseif($res->executive_status == 6){ echo 'Quotation Placed'; }  ?></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>
