<?php $__env->startSection('main-content'); ?>
<main>
    <div class="container-fluid">
        <h2 class="mt-5 mb-4">View Operator</h2>

        <div class="row">
            <div class="col-md-12">
                <div class="card card-primary">
                    <div class="card-header">
                        <h6 class="card-title"></h6>
                    </div>
                    <form action="<?php echo e(url('/branch/view-operator')); ?>" method="get">
                        <div class="card-body" id="demo">
                            <div class="col-md-2">
                                <div class="form-group">
                                    <label>From Date</label>
                                    <input type="date" name="from_date" id="from_date" class="form-control"
                                        value="<?php echo e(Request::get('from_date')); ?>">
                                </div>
                            </div>
                            <div class="col-md-2">
                                <div class="form-group">
                                    <label>To Date</label>
                                    <input type="date" name="to_date" id="to_date" class="form-control"
                                        value="<?php echo e(Request::get('to_date')); ?>">
                                </div>
                            </div>
                          


                            <!-- <div class="col-md-2">
                                <div class="form-group">
                                    <label>Registrar EA Combination</label>
                                    <select name="Ea_Code" id="eacode" onchange="eacodeFun()" class="form-control select2">
                                        <option value="">All</option>
                                        <?php $__currentLoopData = $registrars; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($val->Ea_Code); ?>" <?php echo e(Request::get('Ea_Code')==$val->Ea_Code ?
                                            'selected' : ''); ?>>
                                            <?php echo e($val->Ea_Code); ?> (<?php echo e($val->Ea_Name); ?>)</option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div> -->
                            <div class="col-md-2">
                                <div class="form-group">
                                    <label>State</label>
                                    <select name="state" id="state" onchange="stateFun()" class="form-control select2">
                                        <option value="">All</option>
                                        <?php $__currentLoopData = $state; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $state): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($state); ?>" <?php echo e(Request::get('state')==$state ? 'selected' : ''); ?>>
                                            <?php echo e($state); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-2">
                                <div class="form-group">
                                    <label>District </label>
                                    <select name="District" id="district" onchange="districtFun()" class="form-control select2">
                                        <option value="">All</option>
                                        <?php $__currentLoopData = $District; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($val); ?>" <?php echo e(Request::get('District')==$val ? 'selected' : ''); ?>>
                                            <?php echo e($val); ?> </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-2">
                                <div class="form-group">
                                    <label>Operator</label>
                                    <select name="operator_code" id="operator" class="form-control select2">
                                        <option value="">All</option>
                                        <?php $__currentLoopData = $operatorList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($val->Operator_Code); ?>" <?php echo e(Request::get('operator_code')==$val->Operator_Code ? 'selected' : ''); ?>>
                                            
                                            <?php echo e($val->Operator_Name); ?>

                                            (<?php echo e($val->Operator_Code); ?>)
                                        </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div> 
                            <div class="col-md-2">
                                <input type="submit" class="btn btn-primary" value="Filter" style="margin-top: 25px; float:right;">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="col-md-12"></div>
            <div class="col-md-12">
                <div class="card card-primary">
                    <div class="card-header">
                        <h6 class="card-title"></h6>
                        <a onclick="downloadExcel()" class="btn btn-primary"><i class="fa fa-download"></i> Operator
                            List Download </a>
                    </div>
                    <div class="card-body" id="demo">
                        <div class="table-responsive">
                            <table class="table table-bordered table-striped"  style="width:4000px; height: 600px;"
                                cellspacing="0">
                                <thead>
                                    <tr>
                                        <th>S.No.</th>
                                        <th>Registrar Code</th>
                                        <th>EA Code</th>
                                        <th>Operator Code</th>
                                        <th>Operator Name</th>
                                        <th>Aadhaar Number</th>
                                        <th>SALARY</th>
                                        <th>PF No</th>
                                        <th>ESI No</th>
                                        <th>Station Code</th>
                                        <th>NSE IT Certificate</th>
                                        <th>VTC Village Town City</th>
                                        <th>Post Office</th>
                                        <th>Block</th>
                                        <th>District</th>
                                        <th>State</th>
                                        <th>Center Address</th>
                                        <th>Email ID</th>
                                        <th>Mobile No</th>
                                        <th>Residence_Address </th>
                                        <th>Father_monile_no</th>
                                        <th>Latitude</th>
                                        <th>Longitude </th>
                                        <th>Any Desk ID</th>
                                        <th>view passsword</th>
                                        <th>Status</th>

                                        <!--<th>Action</th>-->
                                        <!--   <th width="10%"></th> -->

                                    </tr>
                                </thead>
                                <tbody>

                                    <?php $__empty_1 = true; $__currentLoopData = $operatorList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key =>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td><?php echo e($key + $operatorList->firstItem()); ?>.</td>
                                        <td><?php echo e($value->Registrar_Code); ?></td>
                                        <td><?php echo e($value->EA_Code); ?></td>
                                        <td><?php echo e($value->Operator_Code); ?></td>
                                        <td><?php echo e($value->Operator_Name); ?></td>
                                        <td><?php echo e($value->Aadhaar_Number); ?></td>
                                        <td><?php echo e($value->SALARY); ?></td>
                                        <td><?php echo e($value->PF_No); ?></td>
                                        <td><?php echo e($value->ESI_No); ?></td>
                                        <td><?php echo e($value->Station_Code); ?></td>
                                        <td><?php echo e($value->NSE_IT_Certificate); ?></td>
                                        <td><?php echo e($value->VTC_Village_Town_City); ?></td>
                                        <td><?php echo e($value->Post_Office); ?></td>
                                        <td><?php echo e($value->Block); ?></td>
                                        <td><?php echo e($value->District); ?></td>
                                        <td><?php echo e($value->State); ?></td>
                                        <td><?php echo e($value->Center_Address); ?></td>
                                        <td><?php echo e($value->Email_ID); ?></td>
                                        <td><?php echo e($value->Mobile_No); ?></td>
                                        <td><?php echo e($value->Residence_Address); ?></td>
                                        <td><?php echo e($value->Father_monile_no); ?></td>
                                        <td><?php echo e($value->Latitude); ?></td>
                                        <td><?php echo e($value->Longitude); ?></td>
                                        <td><?php echo e($value->Any_Desk_ID); ?></td>
                                        <td><?php echo e($value->view_password); ?></td>
                                        <td>
                                            <!-- onchange="test(this,<?php echo e($value->id); ?>)"-->
                                            <select name="status"
                                                id="status_<?php echo e($value->id); ?>_<?php echo e($value->status); ?>" disabled>
                                                <option value="1" <?php echo e($value->status == '1' ? 'selected' : ''); ?>>Active
                                                </option>
                                                <option value="2" <?php echo e($value->status == '2' ? 'selected' : ''); ?>>Inactive
                                                </option>
                                                <option value="3" <?php echo e($value->status == '3' ? 'selected' : ''); ?>>
                                                    Disassociated </option>
                                                <option value="0" <?php echo e($value->status == '0' ? 'selected' : ''); ?>>
                                                    Blacklisted </option>
                                            </select>
                                        </td>
                                        <!--<td><a href="<?php echo e(route('edit.operator', [$value->Operator_Code])); ?>"><i-->
                                        <!--            class="far fa-edit"></i> Edit</a>-->
                                        <!--</td>-->
                                        
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>

                                    <tr>
                                        <td colspan="8">No Record Found !!</td>
                                    </tr>
                                    <?php endif; ?>


                                </tbody>
                            </table>
                            <?php echo $operatorList->appends($_GET)->links(); ?>

                        </div>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->

                <!-- end -->
            </div>
        </div>

    </div>
</main>

<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>

<script>
    function downloadExcel(){
        var from_date     = $('#from_date').val();
        var to_date       = $('#to_date').val();
        var operator_code = $('#operator').val();
        var Ea_Code       = $('#eacode').val();
        var state         = $('#state').val();
        var district      = $('#district').val();
        // alert(operator_code);
        window.location.href = "<?php echo e(url('/branch/get-excel-operator-list')); ?>/?from_date="+from_date+"&to_date="+to_date+"&operator_code="+operator_code+"&district="+district+"&state="+state+"&Ea_Code="+Ea_Code;
    }

    function test(a, id) {
        // alert(a);
        // alert(id);
        // alert('id');
        var x = (a.value || a.options[a.selectedIndex].value); //crossbrowser solution =)

        $.ajax({
            type: "post",
            url: "<?php echo e(route('branch.StatusChange')); ?>",
            data: {
                'id': id,
                "status": x,
                "_token": "<?php echo e(csrf_token()); ?>"
            },
            success: function(res) {
                if (res.data == 1) {
                    toastr.success("successfully");
                     } else {
                    toastr.error("fail!");
                }
            }
        });

    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('branch.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/aks5g/public_html/aadhar.aks.5g.in/resources/views/branch/view-operator.blade.php ENDPATH**/ ?>