<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Labour Law Advice</title>

    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo e(url('public/assets/plugins/fontawesome-free/css/all.min.css')); ?>">
    <!-- icheck bootstrap -->
    <link rel="stylesheet" href="<?php echo e(url('public/assets/plugins/icheck-bootstrap/icheck-bootstrap.min.css')); ?>">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo e(url('public/assets/dist/css/adminlte.min.css')); ?>">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
    <link rel="stylesheet" type="text/css"
        href="https://cdn.datatables.net/buttons/1.7.1/css/buttons.dataTables.min.css">
</head>

<body>

    <div class="container-fluid bg-dark">
        <nav class="navbar navbar-expand-sm navbar-dark">
            <div class="container">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link active" href="#"><i class="fa fa-phone"
                                aria-hidden="true">&nbsp;&nbsp;+91-9919967440</i></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="#"><i class="fa fa-phone"
                                aria-hidden="true">&nbsp;&nbsp;+91-9140861300</i></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="#"><i class="fa fa-envelope"
                                aria-hidden="true">&nbsp;&nbsp;mohdtariq.advocate@gmail.com</i></a>
                    </li>
                </ul>
                <ul class="navbar-nav d-flex">
                    <li class="nav-item">
                        <a class="nav-link float-lg-left" href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a>
                    </li>
                </ul>
            </div>
        </nav>
    </div>

    <div class="container">
        <nav class="navbar navbar-expand-sm ">
            <div class="navbar-brand-wrapper">
                <a class="navbar-brand brand-logo" href="<?php echo e(route('home.page')); ?>"><img
                        src='<?php echo e(("public/assets/users/profiles/images.png")); ?>' height="50px" alt="logo" /></a>
            </div>
            <div class="container-fluid">
                <a class="nav-link" href="#">&nbsp;</a>
                <ul class="navbar-nav d-flex">
                    <li class="nav-item">
                        <a class="btn btn-sm btn-primary" href="<?php echo e(route('login')); ?>" href="#"><i class="fa fa-user"
                                aria-hidden="true"></i>&nbsp;&nbsp;Login</a>
                    </li>
                </ul>
            </div>
        </nav>
    </div>

    <img class="img-fluid" src='<?php echo e(asset("public/assets/users/profiles/pic.jpeg")); ?>' width="100%" height="450px"
        alt=""><br>
        <br>
    <div class="container">
        <h1>Cause List</h1>
        <form action="" name="search_case">
            <div class="row">
                <div class="col-lg-2">
                    <label for="">Select Date:</label>
                    <input type="date" name="case_date" id="case_date" class="form-control">
                </div>
                <div class="col-lg-2">
                    <label for="court_name">Court Name</label>


                    <select name="court_name" id="court_name" class="form-control ">
                        <option value="">Select Court Name</option>
                        <?php $__currentLoopData = $court; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $court): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($court->court_id); ?>"><?php echo e($court->court_name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <!-- <option value="other">Other</option> -->
                    </select>
                </div>
                <div class="col-lg-3">
                    <label for="">Name of Appellant</label>
                    <input type="text" name="name_applicant" id="name_applicant" class="form-control">
                </div>
                <div class="col-lg-3">
                    <label for="">Respodent</label>
                    <input type="text" name="respodent" id="respodent" class="form-control">
                </div>
                <div class="col-lg-2">
                    <label for="">Case No.</label>
                    <input type="text" id="case_number" name="case_number" class="form-control">
                </div>
                <div class="col-lg-2">
                    <label for="">Case Type</label>
                    <select name="case_type" class="form-control" id="case_type">
                        <option value="">Select a case type</option>
                        <option value="1">EPF Appeal</option>
                        <option value="2">Others</option>
                    </select>
                </div>
                <div class="col-lg-2">
                    <button style="margin-top:32px;" class="btn btn-primary" id="reset_form" type="reset">Filter Reset</button>
                </div>
            </div>
        </form>
    </div>
    <br>
        <div class="container">
            <div class="table-responsive">
                <table class="table table-bordered" id="serach_all_case">
                    <button id="printTableButton" class="btn btn-primary m-2">Print</button>
                    <thead>
                        <tr>
                            <th>S.No.</th>
                            <th>Case No.</th>
                            <th>Subject</th>
                            <th>Case Type</th>
                            <th>Name of Appellant</th>
                            <th>Respodent</th>
                            <th>Court Name</th>
                            <th>Next Date</th>
                            <th>Details</th>
                            <th>Order Decision</th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
<br>
    <div class="container-fluid  text-white" style="background-color:#343A40;margin-top:30px;">
        <div class="row">
            <div class="col-6">
                <h6 style="margin-top:20px;"> © Labour Law Advice All rights reserved</h6>
            </div>
            <div class=" col-6">
                <p style="margin-top:10px;" align="right"> Created by Rama Infotech Private Limited</p>
            </div>
        </div>
    </div>
    <!-- jQuery -->
    <script src="<?php echo e(url('public/assets/plugins/jquery/jquery.min.js')); ?>"></script>
    <!-- Bootstrap 4 -->
    <script src="<?php echo e(url('public/assets/plugins/bootstrap/js/bootstrap.bundle.min.js')); ?>"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo e(url('public/assets/dist/js/adminlte.min.js')); ?>"></script>
    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.html5.min.js"></script>
    <script>
        document.getElementById("printTableButton").addEventListener("click", function() {
            var table = $('#serach_all_case').DataTable();
            table.destroy();
            var tableContent = document.getElementById("serach_all_case").outerHTML;
            $('#serach_all_case').DataTable();
            var newWindow = window.open("", "_blank");
            newWindow.document.write("<html><head><title>Claim & Case Diary</title><style>@media  print { table { border-collapse: collapse;width:100%;text-align:center; } th, td { border: 1px solid #000; } }</style></head><body><h4 style='text-align:center;' >Upcoming All Cases</h4>" + tableContent + "</body></html>");
            newWindow.document.close();
            newWindow.print();
        });
    
$(document).ready(function () {
var dataTable;

function updateDataTable(data) {
                var tableBody = $('#serach_all_case tbody');
                tableBody.empty(); // Clear previous rows

                if (data.cases.length > 0) {
                    data.cases.forEach(function(caseDetails, index) {
                        var case_register_for_name = (caseDetails.case_register_for == '1') ? "EPF Appeal" : "Others";
                         var courtNameCell = '';

                    if (isNaN(caseDetails.court_name)) {
                        courtNameCell = '<td>' + caseDetails.court_name + '</td>';
                    } else {
                        courtNameCell = '<td>' + caseDetails.name_c + '</td>';
                    }
                        var row = '<tr>' +
                            '<td>' + (index + 1) + '</td>' +
                            '<td>' + caseDetails.case_number + '</td>' +
                            '<td>' + caseDetails.subject + '</td>' +
                            '<td>' + case_register_for_name + '</td>' +
                            '<td>' + caseDetails.plaintiff + '</td>' +
                            '<td>' + caseDetails.defendant + '</td>' +
                            courtNameCell +
                            '<td>' + caseDetails.hearing_date + '</td>' +
                            '<td>' + caseDetails.case_remark + '</td>' +
                            '<td>' + caseDetails.current_remark + '</td>' +
                            '</tr>';

                        tableBody.append(row);
                    });

                    // Destroy the previous DataTable and initialize a new one


                    // Initialize DataTable with buttons
                    dataTable = $('#serach_all_case').DataTable({
                        dom: 'Bfrtip',
                        buttons: ['csv', 'excel']
                        // Add other DataTables options if needed
                    });
                } else {
                    dataTable = $('#serach_all_case').DataTable({
                        dom: 'Bfrtip',
                        buttons: ['csv', 'excel']
                        // Add other DataTables options if needed
                    });
                    tableBody.append('<tr><td colspan="10">No results found</td></tr>');
                }
            }

            $(document).ready(function () {
                if (dataTable) {
                    dataTable.destroy();
                };
                $('#case_type').on('input', function () {
                    var name = $('#name_applicant').val();
                    var respodent = $('#respodent').val();
                    var date = $('#case_date').val();
                    var cgit = $('#court_name').val();
                    var case_number = $('#case_number').val();
                    var case_type = $(this).val();
                    $.ajax({
                        url: '<?php echo e(route("search_casetypewise")); ?>',
                        type: 'GET',
                        data: {
                            name_applicant: name,
                            case_date: date,
                            cgit: cgit,
                            respodent: respodent,
                            case_number: case_number,
                            case_type: case_type
                        },
                        success: function (data) {
                            console.log()
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });
            $(document).ready(function () {
                if (dataTable) {
                    dataTable.destroy();
                };
                $('#case_number').on('input', function () {
                    var name = $('#name_applicant').val();
                    var respodent = $('#respodent').val();
                    var date = $('#case_date').val();
                    var cgit = $('#court_name').val();
                    var case_number = $(this).val();
                    $.ajax({
                        url: '<?php echo e(route("search_casenumberwise")); ?>',
                        type: 'GET',
                        data: {
                            name_applicant: name,
                            case_date: date,
                            cgit: cgit,
                            respodent: respodent,
                            case_number: case_number
                        },
                        success: function (data) {
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });

            $(document).ready(function () {

                if (dataTable) {
                    dataTable.destroy();
                };
                $('#respodent').on('input', function () {
                    var name = $('#name_applicant').val();
                    var respodent = $(this).val();
                    var date = $('#case_date').val();
                    var cgit = $('#court_name').val();
                    $.ajax({
                        url: '<?php echo e(route("search_namedefendent")); ?>',
                        type: 'GET',
                        data: {
                            name_applicant: name,
                            case_date: date,
                            cgit: cgit,
                            respodent: respodent
                        },
                        success: function (data) {
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });

            $(document).ready(function () {
                if (dataTable) {
                    dataTable.destroy();
                };
                $('#case_date').on('input', function () {
                    var date = $(this).val();

                    $.ajax({
                        url: '<?php echo e(route("search_casedatewise")); ?>',
                        type: 'GET',
                        data: {
                            case_date: date
                        },
                        success: function (data) {
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });

            $(document).ready(function () {
                if (dataTable) {
                    dataTable.destroy();
                };
                $('#court_name').on('input', function () {
                    var court_name = $(this).val();

                    $.ajax({
                        url: '<?php echo e(route("search_courtnamewise")); ?>',
                        type: 'GET',
                        data: {
                            court_name: court_name
                        },
                        success: function (data) {
                            console.log(data);
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });

            $(document).ready(function () {
                if (dataTable) {
                    dataTable.destroy();
                };
                $('#name_applicant').on('input', function () {
                    var name = $(this).val();
                    var date = $('#case_date').val();
                    var cgit = $('#court_name').val();
                    $.ajax({
                        url: '<?php echo e(route("search_nameapplicant")); ?>',
                        type: 'GET',
                        data: {
                            name_applicant: name,
                            case_date: date,
                            cgit: cgit
                        },
                        success: function (data) {
                            if (dataTable) {
                                dataTable.destroy();
                            };
                            updateDataTable(data);
                        },
                        error: function (error) {
                            console.error('Error:', error);
                        }
                    });
                });
            });
        });

        $(document).ready(function () {
                $('#reset_form').on('click', function () {
                    location.reload();
                });
            });
            
    </script>
    
</body>

</html><?php /**PATH /home/data/public_html/legal/resources/views/pages/template/home.blade.php ENDPATH**/ ?>