<?php $__env->startSection('content'); ?>
    <?php Fun::lang()?>
    
        <ol class="breadcrumb">
            <li><a href="#"><?php echo e(__('administrator.Dashboard')); ?></a></li>
            <li class="active"><?php echo e(__('administrator.lead_report')); ?></li>
        </ol>
    
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3><?php echo e(__('administrator.lead_report')); ?> </h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <?php echo Form::open(array('route' => 'lead.lead-report','method'=>'GET')); ?>

                        <div class="form-group col-sm-6 col-xs-12">
                            <div class="col-sm-3 col-xs-12 ">
                                <label for="name"><?php echo e(__('administrator.agent')); ?> </label>
                            </div>
                            <div class="col-sm-9">
                                <?php echo Form::select('agent_id',$agent,null, array('placeholder' => __('administrator.please_select'),'class' => 'form-control  input-md select2','' )); ?>

                            </div>
                        </div>
                        <div class="form-group col-sm-5 col-xs-12">
                            <div class="col-sm-3 col-xs-12 ">
                                <label for="name"><?php echo e(__('administrator.date')); ?> </label>
                            </div>
                            <div class="col-sm-9">
                                <?php echo Form::text('date',(@$_GET['date']?@$_GET['date']:''), array('placeholder' => __('administrator.date'),'class' => 'form-control  input-md date_picker','' )); ?>

                            </div>
                        </div>
                        <div class="col-sm-1 col-xs-12">
                            <?php echo Form::button(__('administrator.search') , array('type' => 'submit','class'=> 'pull-right btn btn-default',)); ?>

                        </div>
                        <?php echo e(Form::close()); ?>

                    </div>
                </div>
            </div>
        </div>
        <div class="box-body">
            <table id="datatable_products" width="100%" class="table table-striped">
                <thead>
                <tr>
                    <th>#</th>
                    <th><?php echo e(__('administrator.date')); ?></th>
                    <th><?php echo e(__('administrator.agent')); ?></th>
                    <th><?php echo e(__('administrator.name')); ?></th>
                    <th><?php echo e(__('administrator.contact')); ?></th>
                    <th><?php echo e(__('administrator.total_call')); ?></th>
                    <th><?php echo e(__('administrator.total_appointment')); ?></th>
                    <th><?php echo e(__('administrator.total_meeting')); ?></th>
                    <th><?php echo e(__('administrator.close_deal')); ?></th>
                </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </div>
        </div>

        <?php $__env->stopSection(); ?>
        <?php $__env->startSection('js'); ?>
            <script type="text/javascript">
                $(document).ready(function () {
                    path = window.location.pathname;
                    window.history.replaceState({}, document.title, path);
                    $('#datatable_products').DataTable({
                        ordering: false,
                        serverSide: true,
                        lengthMenu: [[20, 30, 50, 100, 200, 500, 1000], [20, 30, 50, 100, 200, 500, 1000]],
                        ajax: "<?php echo e(route('datatable.lead-report')); ?>?agent_id=<?php echo e(isset($_GET['agent_id'])?$_GET['agent_id']:'0'); ?>&date=<?php echo e(isset($_GET['date'])?$_GET['date']:'0'); ?>",
                        columns:
                            [
                                {data: 'DT_RowIndex','searchable':false},
                                {data: 'date','name':'nso007_crm_leads.date'},
                                {data: 'agent_name','name':'users.name'},
                                {data: 'name','name':'nso007_crm_leads.name'},
                                {data: 'contact','name':'nso007_crm_leads.contact'},
                                {data: 'total_call'},
                                {data: 'total_appointment'},
                                {data: 'total_meeting'},
                                {data: 'close_deal'},
                            ],
                        "initComplete": function (settings, json) {
                        }
                    });
                    $.fn.dataTable.ext.errMode = 'throw';
                });
                $(document).on('click', '.delete_products', function () {
                    $('#form_delete').modal('show');
                    var id = $(this).data("id");
                    $(".deleteRecord").click(function () {
                        var token = $("meta[name='csrf-token']").attr("content");
                        $.ajax({
                            url: "<?php echo e(route('lead.delete_lead')); ?>",
                            type: 'GET',
                            data: {
                                "id": id,
                                "_token": token,
                            },
                            success: function () {
                                $('#form_delete').modal('hide');
                                location.reload();

                            }
                        });
                    });
                });
            </script>
<?php $__env->stopSection(); ?>

    


<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>