<?php $__env->startSection('title','Detailed Claim Report | '); ?>
<?php $__env->startSection('content'); ?>
<!-- Content Header (Page header) -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0">Detailed Claim Report</h1>
            </div><!-- /.col -->
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">Claim Report</li>
                </ol>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->

<section class="content">
    <div class="container-fluid">
        <form id="report_form" class="hide_in_print">
            <div class="row">
                <div class="col-md-12">
                    <div class="row">
                        <div class="col-md-6 col-lg-4">
                            <div class="form-group">
                                <label>Report Type:</label>
                                <select name="report_type" id="report_type"
                                    class="custom-select <?php if( $errors->has('report_type')): ?> is-invalid border-danger  <?php endif; ?>"
                                    style="width: 100%;">
                                    <option value="">Select Report Type</option>
                                    <?php
                                    $report_type = getReportType();
                                    ?>
                                    <?php $__currentLoopData = $report_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($key); ?>" <?php if(old('report_type')==$key): ?>) <?php echo e(__('selected')); ?>

                                        <?php endif; ?>><?php echo e($value); ?>

                                    </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-3 col-lg-4 date-column">
                            <div class="form-group">
                                <label>From Date:</label>
                                <input type="date" class="form-control" value="<?php echo e(date('Y-m-d')); ?>" name="from_date"
                                    id="from_date" max="<?php echo e(date('Y-m-d')); ?>">
                            </div>
                        </div>
                        <div class="col-md-3 col-lg-4 date-column">
                            <div class="form-group">
                                <label>To Date:</label>
                                <input type="date" class="form-control" name="to_date" value="<?php echo e(date('Y-m-d')); ?>"
                                    id="to_date" max="<?php echo e(date('Y-m-d')); ?>">
                            </div>
                        </div>
                        <div class="col-md-3 col-lg-4 month-column">
                            <div class="form-group">
                                <label for="month_from">From Month:</label>
                                <input type="month" class="form-control" name="from_month" value="<?php echo e(date('Y-m')); ?>"
                                    id="month_from" max="<?php echo e(date('Y-m')); ?>">
                            </div>
                        </div>
                        <div class="col-md-3 col-lg-4 month-column">
                            <div class="form-group">
                                <label for="month_to">To Month:</label>
                                <input type="month" class="form-control" name="to_month" value="<?php echo e(date('Y-m')); ?>"
                                    id="month_to" max="<?php echo e(date('Y-m')); ?>">
                            </div>
                        </div>
                        <div class="col-md-3 col-lg-4 category-column">
                            <div class="form-group">
                                <label for="category">Claim Category:</label>
                                <select name="category" id="category" class="custom-select">
                                    <option value="">Select Claim Category</option>
                                    <?php $categories = getClaimCategories(); ?>
                                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($key); ?>"><?php echo e($value); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-12 col-lg-12">
                            <div class="input-group">
                                <button type="button" class="btn btn-primary" id="search_report">
                                    <i class="fa fa-search"></i> Search
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>

        <div class="card mt-4" id="">
            <div class="card-header">
                <div class="card-title font-weight-bolder">
                    <span id="search_type"></span> <span id="search_from_to"></span>
                </div>
                <!-- <button type="button" class="float-right btn btn-primary print_btn hide_in_print">Print
                    Report</button> -->
                <a id="data_export_link" href="#" class="btn float-right mr-2 btn-secondary">Download Excel</a>
            </div>
            <div class="card-body" id="report_body">
                <table id="claim_summary_report_table" class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Sr No.</th>
                            <th>Claim Master ID</th>
                            <th>Emp ID</th>
                            <th>Emp Name</th>
                            <th>Emp Mobile</th>
                            <th>Claim Type</th>
                            <th>Claim For</th>
                            <th>Claim By</th>
                            <th>Accident Info</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody id="claim_summary_report_data">
                        <!-- <tr>
                            <td colspan="9" class="text-center">No Record Found</td>
                        </tr> -->
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('js'); ?>
<script>
// for claim detailed summary report data table
// $(function() {

// .buttons().container().appendTo('#EmployeeList_wrapper .col-md-6:eq(0)');
// });
let detailed_report_table = $('#claim_summary_report_table');
// Search Detailed Claim Report
$('#search_report').click(function() {
    let search_type = $('#search_type');
    let search_from_to = $('#search_from_to');
    let type_text = $('#report_type').find('option:selected').text();
    let type = $('#report_type').find('option:selected').val();
    let excel_url = "<?php echo e(route('export.claim.excel')); ?>";
    let form = $('#report_form').serialize();
    let href = excel_url + "/?" + form;
    $('#data_export_link').attr('href', href);

    if (type == '') {
        alert('Please Select Record Type');
    } else {
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
            }
        });
        let url = "<?php echo e(route('get.detailed.claim.report')); ?>";
        $.ajax({
            url: url,
            type: 'post',
            data: $('#report_form').serialize(),
            // dataType: 'json',
            beforeSend: function() {
                detailed_report_table.DataTable().clear().draw();
                detailed_report_table.DataTable().destroy();
            },
            success: function(data) {
                search_type.text(type_text);
                $('#claim_summary_report_data').html(data);
                // detailed report Data Table
                detailed_report_table.DataTable({
                    "paging": true,
                    "lengthChange": true,
                    "searching": true,
                    "ordering": true,
                    "info": true,
                    "autoWidth": false,
                    "responsive": true,
                    "destroy": true,
                    // "butt ons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
                    // "buttons": ["csv", "excel", "pdf"]
                });
            }
        });
    }
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/data/public_html/legal/resources/views/pages/claims/detailedReportSummary.blade.php ENDPATH**/ ?>