<?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]-->

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



<script>
    function addreport()
    {
        
        if(document.getElementById('bdo').value == "")
        {
            alert("please Select BDO!");
            $('#bdo').focus();
            return false;
        }
        if(document.getElementById('rep_date').value == "")
        {
            alert("please Enter Date.!");
            $('#rep_date').focus();
            return false;
        }
        if(document.getElementById('reportt').value == "")
        {
            alert("please Enter Report.!");
            $('#reportt').focus();
            return false;
        }

        var bdo = $('#bdo').val();
        var rep_date = $('#rep_date').val();
        var reportt = $('#reportt').val();

        $.ajax({
            url   :"ajax_tele_call.php" ,
            type  : "POST",
            data  :
            {
                btn_daily_report : 1,
                bdo  : bdo,
                rep_date    : rep_date,
                reportt   : reportt
            },
            success:function(res11)
            {
            	  alert(res11);
                  $('#bdo').val('');
                  $('#rep_date').val('');
                  $('#reportt').val('');
                  window.location.href = 'Marketing-Add-Report';
                
            }
        });

    }
    
    
    
    function updatereport(){
    	
    	  var bdo = $('#bdo').val();
        var rep_date = $('#rep_date').val();
        var reportt = $('#reportt').val();
        var upval = $('#upval').val();

        $.ajax({
            url   :"ajax_tele_call.php" ,
            type  : "POST",
            data  :
            {
                updt_btn_daily_report : 1,
                bdo  : bdo,
                rep_date    : rep_date,
                reportt   : reportt,
                upval     : upval
            },
            success:function(res11)
            {
            	  alert(res11);
                  $('#bdo').val('');
                  $('#rep_date').val('');
                  $('#reportt').val('');
                  window.location.href = 'Marketing-Add-Report';
                
            }
        });

    }
    
    function delete_report(idd){
    	var result = confirm("Want to delete?");
			if (result) 
			{
        $.ajax({
            url   :"ajax_tele_call.php" ,
            type  : "POST",
            data  :
            {
                delet_btn_daily_report : 1,
                idd  : idd,
              
            },
            success:function(res11)
            {
            	  alert(res11);
                  window.location.href = 'Marketing-Add-Report';
                
            }
        });
       }
    }
</script>
    




<script>
	function edt_report(id)
    	{
    	
		$.ajax({
            url   :"ajax_tele_call.php" ,
            type  : "POST",
            data  :
            {
                btn_edt_report : 1,
                id                : id
            },
            success:function(res112)
            {
                $('#edt_data').html(res112);
                datpic();
            }
        });
   			
    	}
</script>


</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 () {
                $('#rep_date').daterangepicker({
                    singleDatePicker: true,
                    calender_style: "picker_4"
                }, function (start, end, label) {
                    console.log(start.toISOString(), end.toISOString(), label);
                });
            });
            function datpic(){
            	$(document).ready(function () {
                $('#rep_date').daterangepicker({
                    singleDatePicker: true,
                    calender_style: "picker_4"
                }, function (start, end, label) {
                    console.log(start.toISOString(), end.toISOString(), label);
                });
            });
            }
        </script>
        <script type="text/javascript">
            $(document).ready(function () {
                $('#src_date').daterangepicker({
                    singleDatePicker: true,
                    calender_style: "picker_4"
                }, function (start, end, label) {
                    console.log(start.toISOString(), end.toISOString(), label);
                });
            });
        </script>

        <!-- page content -->
        <div class="right_col" role="main" >


            <div class="row">

                <div class="col-md-12 col-sm-12 col-xs-12" > 
                    <div class="x_panel" >
                        <div class="x_title">
                            <h2>Daily Report<small>Add</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="edt_data" >
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="col-md-3">
                                        <select class="bdo form-control col-md-7 col-xs-12" id="bdo" required="required" name="bdo">
                                            <option value=""></option>
                                            <?php
                                            $emp = mysqli_query($con,"SELECT id,emp_name FROM employee_registration");
                                            while($emp_list = mysqli_fetch_object($emp))
                                            {
                                                ?>
                                                <option value="<?php echo $emp_list->id; ?>"><?php echo $emp_list->emp_name; ?></option>
                                            <?php
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="col-md-6">

                                    </div>
                                    <div class="col-md-3">
                                        <input id="rep_date" class="form-control col-md-7 col-xs-12" placeholder="Enter Date"  type="date" name="rep_date" >
                                    </div>
                               </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-md-12">
                                	<div class="col-md-11">
                                        <textarea class="col-md-12 form-control" placeholder="Enter Report" name="reportt" id="reportt"></textarea>
                                     </div>
                                       <div class="col-md-1">
                                       	<input type="button" class="btn btn-primary " value="Save" style="float: right; margin-top: 40px;" onclick="addreport();">
                                       	</div>  
                                </div>
                            </div>
                           <!-- <br>
                            <input type="button" class="btn btn-primary " value="Save" style="float: right;" onclick="addreport();"> -->
                        </div>
                    </div>
                </div>

            </div>































          <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">

<div class="x_panel">
            <div class="x_title">
                <h2>All Reports<small>View</small></h2>
                <ul class="nav navbar-right panel_toolbox">
                	<a href="reportprint.php" target="_blank"> <i class="fa fa-print" style="font-size:20px; margin-top: 3px; float: left; margin-right: 10px;"></i></a>
                    <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="dataTables_wrapper">
                    <table class="table table-striped table-bordered table-hover table-responsive" id="dataTables-example">
                        <thead>
                        <tr>
                            <!--<th>#</th>-->
                            <th>ID</th>
                             <th>Exe. BDO</th>
                            <th class="hidden-xs">Report Date</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                        $stmt = mysqli_query($con,"SELECT * FROM `daily_rep_det` ");
                        $i=1;
                        while($res = mysqli_fetch_object($stmt))
                        {
                            $ex_bdo = $res->bdo_id;
                            $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_exe_data(<?php echo $res->id; ?>)" title="Add Reort" style="cursor: pointer;">
                                <!--<td></td>-->
                                <td><?php echo $i; ?></td>
                                <td><?php echo $qry15_fet->emp_name; ?></td>
                                <td><?php echo $res->report_date; ?></td>
                                <td><a onClick="edt_report('<?php echo $res->id; ?>');" style=" cursor: pointer;" ><span class="fa fa-pencil" style="font-size:14px;"></span></a> &nbsp; &nbsp;
                                	<a onClick="delete_report('<?php echo $res->id; ?>');" style=" cursor: pointer;" ><span class="fa fa-trash-o" style="font-size:14px;"></span></a> &nbsp;
                                	</td>
                            </tr>
                            <?php
                            $i++;
                        }
                        $stmt->close();
                        ?>
                        </tbody>
                    </table>
                </div>
                <!-- /.table-responsive -->
   







              </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>


<!-- chart js -->
<script src="../components/js/chartjs/chart.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>

<!-- form validation -->
<!--<script type="text/javascript" src="js/parsley/parsley.min.js"></script>-->

<!-- textarea resize -->
<script src="../components/js/textarea/autosize.min.js"></script>
<script>
    autosize($('.resizable_textarea'));
</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>
