

<?php $__env->startSection('title', 'Users'); ?>
<?php $__env->startSection('dynamic_css_excpt'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('dynamic_css'); ?>
    <!-- <link href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" media="all" rel="stylesheet" type="text/css"/>-->
    <link href="<?php echo asset('css/dataTables.bootstrap4.min.css'); ?>" media="all" rel="stylesheet" type="text/css"/>
    <link href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.bootstrap4.min.css" media="all" rel="stylesheet" type="text/css"/>
    <style>
        select.form-control:not([size]):not([multiple]) {
            height: calc(1.95rem + 0px);
        }
        .panel-title{
            font-size: 15px;
            display: table-cell;
            vertical-align: middle;
        }
        .custom-col-md-6{
            width:50%;
            display: table;
            height: 40px;
        }
        .table td {
            padding: .5rem 1rem .5rem 1rem;
            vertical-align: middle;
            border-top: 1px solid #dee2e6;
        }
        .table .btn{
            min-width: 89px;
        }

        select options {
            text-transform: capitalize;
        }

        .text-blue{
            color: #304192;
            font-weight: 600;
            font-size: 14px;
        }
        /************************ slider button ************************************/

        /* The switch - the box around the slider */
        .switch {
            position: relative;
            display: inline-block;
            width: 55px;
            height: 26px;
        }

        /* Hide default HTML checkbox */
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        /* The slider */
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            /* background-color: red;*/
            -webkit-transition: .4s;
            transition: .4s;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 24px;
            width: 24px;
            left: 3px;
            bottom: 1px;
            background-color: white;
            -webkit-transition: .4s;
            transition: .4s;

        }

        input:checked + .slider {
            background-color: #2196F3;
            /* background-color: green;*/
        }

        input:focus + .slider {
            box-shadow: 0 0 1px #2196F3;
            /* background-color: green;*/
        }

        input:checked + .slider:before {
            -webkit-transform: translateX(26px);
            -ms-transform: translateX(26px);
            transform: translateX(26px);
        }

        /* Rounded sliders */
        .slider.round {
            border-radius: 34px;
        }

        .slider.round:before {
            border-radius: 50%;
        }

        .vl{
            height: 26px;
            border-left: 1px solid #999;
        }

        .fBlack{
            color:#999;
        }

        /*****************************************************************************/
        @media (max-width: 768px)
        {
            li.page-item {

                display: none;
            }
            .custom-col-md-6{
                width:50%;
                display: table;
                height: 34px;
            }
            .page-item.previous,
            .page-item.next,
            .page-item:first-child,
            .page-item:last-child,
            .page-item.active {

                display: block;
            }

            .result-set{
                padding-left: 15px;
                padding-right: 15px;
            }

            .btn.btn-sm,.btn.btn-xsm {
                padding: .3rem .7rem;
                font-size: .54rem;
            }
            .table .btn {
                min-width: 50px;
            }

            .btn.btn-xsm{
                padding: .2rem .2rem;
            }

            #data-table{
                width: 100% !important;
            }

        }

        .dataTables_filter{
            display: inline-block;
            float: right;
        }

        .btn-secondary {
            background-color: #1c7095!important;
            color: #fff!important;
            padding: .40rem .60rem;
        }






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

<?php $__env->startSection('content'); ?>
    <div class="container">
        <div class="row container_layout">
            <div class="col-md-12 pl0 pr0 mobile_view">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                            <a href="<?php echo e(route('adminhome')); ?>">
                                <i class="material-icons">home</i>
                            </a>
                        </li>
                        <li class="breadcrumb-item"><a href="<?php echo e(route('employees')); ?>">Employees</a></li>
                        <li class="breadcrumb-item active"><a href="<?php echo e(route('servicedashboard')); ?>">Service Management</a></li>
                    </ol>
                </nav>
            </div>


            <div class="col-md-12 p20 bg-white">
                <div class="panel panel-default">
                    <div class="panel-heading search_bar " style="display: none">

                        <div class="row e1f5fe bdbdbd grey lighten-1 custom_row_o" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample" style="cursor: pointer;">
                            <div class="col-md-6 custom-col-md-6" style="max-width: 50%;">

                                <div class="panel-title pl5">
                                    <i class="fa fa-filter"></i> <span class="label_text"> Custom Filter </span>
                                </div>

                            </div>
                            <div class="col-md-6 custom-col-md-6 text-right" style="max-width: 50%;">

                            </div>
                        </div>

                    </div>
                    <div class="panel-body">
                        <div class="row bg_body custom_row_o filter" style="display: none">
                            <div class="col-md-12 collapse show mt10" id="collapseExample">

                                <?php echo e(csrf_field()); ?>

                                <div class="row result-set">
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue"> District </label>
                                        <select class="form-control input-md" id="district" name="district">
                                            <?php if($data['districts']): ?>
                                                <option value="" selected disabled>==== Select District ====</option>
                                                <option value="1" <?php if($data['district']==1): ?> <?php echo e('selected'); ?> <?php endif; ?>> All </option>

                                                <?php $__currentLoopData = $data['districts']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(($data['district']) && ($data['district']==$dist->district_code)): ?>
                                                        <option value="<?php echo e($dist->district_code); ?>" selected> <?php echo e($dist->district_name); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($dist->district_code); ?>"> <?php echo e($dist->district_name); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                                <option value="<?php echo e($data['district']); ?>" selected><?php echo e($data['district_name']); ?></option>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue">Block</label>
                                        <select class="form-control input-md" id="block" name="block">

                                            <?php if($data['block_list']): ?>
                                                <option value="" disabled selected>==== Select A Block ====</option>
                                                <?php $__currentLoopData = $data['block_list']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $blk): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(($data['block']) && ($data['block']==$blk->block_id)): ?>
                                                        <option value="<?php echo e($blk->block_id); ?>" selected> <?php echo e($blk->block_name); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($blk->block_id); ?>"> <?php echo e($blk->block_name); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php elseif($data['block']): ?>
                                                <option value="<?php echo e($data['block']); ?>" selected><?php echo e($data['block_name']); ?></option>
                                            <?php else: ?>
                                                <option value="" disabled selected>==== Select A Block ====</option>
                                            <?php endif; ?>

                                        </select>
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue">Gram Panchayat</label>
                                        <select class="form-control input-md" id="panchyat" name="panchyat">
                                            <option value="">==== Select Gram Panchayat ====</option>
                                            <?php if($data['panchyat_list']): ?>
                                                <?php $__currentLoopData = $data['panchyat_list']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(($data['panchyat']) && ($data['panchyat']==$pan->gram_panchyat_id)): ?>
                                                        <option value="<?php echo e($pan->gram_panchyat_id); ?>" selected> <?php echo e($pan->gram_panchyat_name); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($pan->gram_panchyat_id); ?>"> <?php echo e($pan->gram_panchyat_name); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>



                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue">Program</label>
                                        <select class="form-control input-md" id="program" name="program">
                                            <option value=""  selected>==== Select Program ====</option>
                                            <?php if($data['programe']): ?>
                                                <?php $__currentLoopData = $data['programe']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                                    <?php if(($data['program_s']) && ($data['program_s']==$pr->program_id)): ?>
                                                        <option value="<?php echo e($pr->program_id); ?>" selected> <?php echo e($pr->program_name); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($pr->program_id); ?>"> <?php echo e($pr->program_name); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="row result-set">
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue">Level</label>
                                        <select class="form-control input-md" id="level" name="level">
                                            <option value=""  selected>==== Select Levels ====</option>
                                            <?php if($data['level']): ?>
                                                <?php $__currentLoopData = $data['level']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lev): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(($data['level_s']) && ($data['level_s']==$lev->level_id)): ?>
                                                        <option value="<?php echo e($lev->level_id); ?>" selected> <?php echo e($lev->level); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($lev->level_id); ?>"> <?php echo e($lev->level); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <label class="control-label text-blue"> Designation </label>
                                        <select class="form-control input-md" id="designation" name="designation">
                                            <option value="">==== Select Designation ====</option>
                                            <?php if($data['designation_list']): ?>
                                                <?php $__currentLoopData = $data['designation_list']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $des): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(($data['designation_s']) && ($data['designation_s']==$des->designation_id)): ?>
                                                        <option value="<?php echo e($des->designation_id); ?>" selected> <?php echo e($des->designation_name); ?> </option>
                                                    <?php else: ?>
                                                        <option value="<?php echo e($des->designation_id); ?>"> <?php echo e($des->designation_name); ?> </option>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                    
                                        
                                        
                                            
                                            
                                                


                                                    
                                                        
                                                    
                                                        
                                                    
                                                
                                            
                                        
                                    
                                    <div class="col-md-3 text-right margin-auto">
                                        <button type="submit" class="btn btn-primary btn-sm search"><i class="fa fa-search" aria-hidden="true"></i> Search</button>
                                        <a href="" class="btn btn-warning  btn-sm"> <i class="fa fa-refresh" aria-hidden="true"></i> Reset</a>
                                    </div>
                                </div>

                            </div>
                        </div>
                        <div class="month_report" style="height: auto;width: 100%;margin-top: 10px;padding: 10px;text-align: center">

                           <?php if($month=='submitted'): ?>
                            <div>
                                <?php if(!empty($month_data)): ?>
                                <h3 style="color: red;font-weight: bold">Absentee Reports already Submitted for the Month of</h3><h2 style="color: #19255f"><?php echo e($month_data); ?></h2>
                            </div>
                               <?php endif; ?>

                            <?php else: ?>

                                <h3>Is there any Termination, Resignation, etc. in</h3><h2 style="color: #19255f"><?php echo e($month); ?></h2>
                                <div>
                                    <button id="report_yes" class="btn btn-success btn-sm">Yes</button>
                                    <button id="report_no" class="btn btn-danger btn-sm">No</button>
                                </div>


                                <?php endif; ?>


                        </div>
                        <div class="confirm_submit" style="height: auto;width: 100%;margin-top: 10px;padding: 10px;text-align: center;display: none">


                                <h3>Are you sure you want to submit Service report for the month of</h3><h2 style="color: #19255f"><?php echo e($month); ?></h2>
                                <div>
                                    <button id="report_yes" class="btn btn-success btn-sm">Yes</button>
                                    <button id="report_reset" class="btn btn-danger btn-sm">No</button>
                                </div>





                        </div>
                        <?php if(!empty($month_format)): ?>
                        <input type="hidden" id="report_date" value="<?php echo e($month_format); ?>">
                        <?php endif; ?>
                        <div class="result-set mt10" id="no-more-tables">
                            <div class="row">
                                <div class="col-md-12 pl0 pr0">
                                    <table class="table  service" cellspacing="10" style="width: 100%!important;display: none">
                                        <thead>
                                        <tr class="note note-primary">
                                            <th scope="col" class="note-dange">#</th>
                                            <th scope="col" style="width: 110px;">Employee Code</th>
                                            <th scope="col" style="width: 101px;">Employee Name</th>
                                            <th scope="col" style="width: 139px;">Designation</th>
                                            <th scope="col" style="width: 95px;">District</th>
                                            <th scope="col" style="width: 50px;">Block</th>
                                            <th scope="col" style="width: 45px;">GP</th>
                                            <th scope="col" style="width: 185px;">Action</th>
                                            <th></th>
                                        </tr>
                                        </thead>

                                    </table>

                                </div>
                            </div>
                        </div>



                    </div>
                </div>
            </div>



        </div>

    </div>


    <div class="modal fade top" id="fluidModalTopTerminated" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="true"  style="display: none;" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-top modal-notify modal-primary" role="document">
            <!--Content-->
            <div class="modal-content">
                <!--Header-->
                <div class="modal-header">
                    <p class="heading lead">Employee Service</p>

                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" class="white-text">×</span>
                    </button>
                </div>

                <!--Body-->
                <div class="modal-body">
                    <div class="container">
                        <div class="row">
                            <table class="posting_view">
                                <tbody><tr>
                                    <th><span style="color: #3971d6;font-weight: 800;">Employee Code</span></th>
                                    <td>:  <span style="font-weight: bold" id="emp_code"></span></td>
                                </tr>
                                <tr>
                                    <th><span style="color: #3971d6;font-weight: 800;">Employee Name </span></th>
                                    <td>:  <span style="font-weight: bold" id="name"></span></td>
                                </tr>
                                <tr>
                                    <th><span style="color: #3971d6;font-weight: 800;"> Designation </span></th>
                                    <td>:  <span style="font-weight: bold" id="des"></span></td>
                                </tr>
                                <tr>
                                    <th><span style="color: #3971d6;font-weight: 800;"> Mobile </span></th>
                                    <td>:  <span style="font-weight: bold" id="mobile"></span></td>
                                </tr>
                                </tbody></table>

                        </div>
                        <hr>
                        <form method="post" id="service_form">
                            <div class="row">
                                <div id="error"></div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label>Date<span style="color: red">*</span></label>

                                            <input type="date" class="form-control" name="order_date" required>

                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label>Order No<span style="color: red">*</span></label>
                                        <input type="text" name="order_no" class="form-control" id="order_no" required>
                                    </div>
                                </div>
                                <input type="hidden" id="service_status_id" name="service_status_id">
                                <input type="hidden" id="employee_id" name="employee_id">


                                <?php echo e(csrf_field()); ?>

                                <div class="col-md-4">
                                    <label>Order Copy<span style="color: red">*</span></label>
                                    <div class="form-group">



                                            <input type="file" class="form-control" name="order_file" id="inputGroupFile01"/>

                                    </div>
                                </div>
                            </div>
                            <div class="row">


                                <div class="col-md-4">
                                    <label>Remark</label>
                                    <div class="form-group">
                                        <textarea class="form-control" placeholder="Remark"></textarea>
                                    </div>
                                </div>

                            </div>

                            <div class="row">
                                <button type="submit" id="submit_service" class="btn btn-success btn-sm">Submit</button>
                                <button type="submit" data-dismiss="modal" aria-label="Close" name="" class="btn btn-danger btn-sm">Cancel</button>

                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>




    <?php $__env->stopSection(); ?>
<?php $__env->startSection('dynamic_js'); ?>
    <script src="<?php echo e(asset('js/lib/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('js/lib/dataTables.bootstrap4.min.js')); ?>"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.bootstrap4.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.colVis.min.js"></script>
    <script src="<?php echo e(asset('vendor/datatables/buttons.server-side.js')); ?>"></script>
    <script src="<?php echo e(asset('plugins/bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker.js')); ?>"></script>

    <!--<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>-->

    <script>
        $(document).on('change','#district',function () {
            $('.page-loader-wrapper').fadeIn();
            var dis_id=$('#district').val();
            $('#block').empty();
            var option = "<option value=''>==== Select A Block ====</option>";
            $('#block').append(option);
            $('#panchyat').empty();
            var option = "<option value=''>==== Select Gram Panchayat ====</option>";
            $('#panchyat').append(option);
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                type: "POST",
                url: "<?php echo e(route('employeeVerificationGetBlock')); ?>",
                dataType: 'json',
                data: {'dis_id': dis_id},
                success: function (data) {
                    $('.page-loader-wrapper').fadeOut();
                    if (data.msg == 'success') {
                        $('#block').empty();
                        var option = "<option value=''>==== Select A Block ====</option>";
                        $.each(data.block,function (index,value) {
                            option += '<option value="'+value.block_id+'">'+value.block_name+'</option>'
                        });

                        $('#block').append(option);
                    }
                    if (data.msg == 'failed') {

                        Swal.fire({
                            type: 'error',
                            title: 'Oops...',
                            text: 'Something went wrong!'
                        })
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    $('.page-loader-wrapper').fadeOut();
                    Swal.fire({
                        type: 'error',
                        title: 'Oops...',
                        text: 'Something went wrong!',

                    })
                }
            })

        });
        $(document).on('change','#block',function () {
            var block_id=$('#block').val();
            $('.page-loader-wrapper').fadeIn();
            $('#panchyat').empty();
            var option = "<option value=''>==== Select Gram Panchayat ====</option>";
            $('#panchyat').append(option);
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                type: "POST",
                url: "<?php echo e(route('employeeVerificationGetGp')); ?>",
                dataType: 'json',
                data: {'block_id': block_id},
                success: function (data) {

                    $('.page-loader-wrapper').fadeOut();
                    if (data.msg == 'success') {
                        $('#panchyat').empty();
                        var option = "<option value=''>==== Select Gram Panchayat ====</option>";
                        $.each(data.gp,function (index,value) {
                            option += '<option value="'+value.gram_panchyat_id+'">'+value.gram_panchyat_name+'</option>'
                        });

                        $('#panchyat').append(option);
                    }
                    if (data.msg == 'failed') {
                        $('.page-loader-wrapper').fadeOut();
                        Swal.fire({
                            type: 'error',
                            title: 'Oops...',
                            text: 'Something went wrong!'
                        })
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {

                    Swal.fire({
                        type: 'error',
                        title: 'Oops...',
                        text: 'Something went wrong!',


                    })
                }
            })

        });


        $(document).on('change','#level',function (e) {
            e.preventDefault();
            $('.page-loader-wrapper').fadeIn();
            var level=$('#level').val()
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                type: "POST",
                url: "<?php echo e(route('get_designation')); ?>",
                dataType: 'json',
                data: {'level': level},
                success: function (data) {
                    $('.page-loader-wrapper').fadeOut();

                    $('.page-loader-wrapper').fadeOut();
                    if (data.msg == 'success') {
                        $('#designation').empty();
                        var option = "<option value=''>==== Select Designation ====</option>";
                        $.each(data.designation,function (index,value) {
                            option += '<option value="'+value.designation_id+'">'+value.designation_name+'</option>'
                        });

                        $('#designation').append(option);
                    }
                    if (data.msg == 'failed') {
                        $('.page-loader-wrapper').fadeOut();
                        Swal.fire({
                            type: 'error',
                            title: 'Oops...',
                            text: 'Something went wrong!'
                        })
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    $('.page-loader-wrapper').fadeOut();

                    Swal.fire({
                        type: 'error',
                        title: 'Oops...',
                        text: 'Something went wrong!',


                    })
                }
            })

        })

        $(document).on('click','#report_yes',function (e) {
            e.preventDefault();
            $('.service').show();
            $('.filter').show();
            $('.search_bar').show();
            $('.confirm_submit').show();
            $('.month_report').hide();

            $('.service').DataTable({
                "processing": true,
                "serverSide": true,
                "stateSave": true,

                "ajax": {
                    "url": "<?php echo e(route('employeeService')); ?>",
                    "data": function (d) {
                        d.dis_id=$('#district').val();
                        d.block_id=$('#block').val();
                        d.panchayat_id=$('#panchyat').val();
                        d.program_id=$('#program').val();
                        d.level_id=$('#level').val();
                        d.des_id=$('#designation').val();
                        d.ser_status=$('#service_status').val();
                    }
                },

                "columns": [
                    {"data": 'DT_Row_Index', name: 'DT_Row_Index'},
                    {"data": "employee_code"},
                    {"data": "name"},
                    {"data": "designation_name"},
                    {"data": "district_name"},
                    {"data": "block_name"},
                    {"data": "gram_panchyat_name"},
                    {"data": "action"},

                ]


            });
        })

        $(document).on('click','#report_no',function (e) {

            var date=$('#report_date').val();



            swal({
                title: 'Are you sure?',
                text: "There is no Termination Resignation etc in the Month of <?php echo e($month); ?>",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',

                confirmButtonText: "CONFIRM",
                cancelButtonText: "CANCEL"
            }).then((result) => {
                if (result.value)
            {
                $.ajax({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    type: "POST",
                    url: "<?php echo e(route('submitServiceNo')); ?>",
                    dataType: 'json',
                    data: {'date': date},
                    success: function (data) {

                        if (data.msg == 'success') {


                            swal({

                                text: "Thank you for submitting the Absentee Report for the month of <?php echo e($month); ?>",
                                type: 'success',
                                showCancelButton: false,
                                confirmButtonColor: '#3085d6',
                                cancelButtonColor: '#d33',

                                confirmButtonText: "Ok",

                            }).then((result) => {
                                if (result.value)
                            {
                            location.reload()
                            }else{
                                location.reload()
                            }
                        })

                        }
                        if (data.msg == 'failed') {

                            Swal.fire({
                                type: 'error',
                                title: 'Oops...',
                                text: 'Something went wrong!'
                            })
                        }
                        if (data.msg == 'exist') {

                            Swal.fire({
                                type: 'error',
                                title: 'Oops...',
                                text: 'Report is already submitted for the month of <?php echo e($month); ?>!'
                            })
                        }
                    },
                    error: function (jqXHR, textStatus, errorThrown) {

                        Swal.fire({
                            type: 'error',
                            title: 'Oops...',
                            text: 'Something went wrong!',

                        })
                    }
                })
            }
        })
        })


        $(document).on('click','#report_reset',function (e) {
            e.preventDefault()
           location.reload()
        })


        $(document).on('click', '.search', function (e) {
            e.preventDefault();
            $('.service').DataTable().ajax.reload();

        });


        $(document).on('change','.status',function (e) {
            e.preventDefault()
            

             var status_id=$(this).val()

      
             var code=$(this).data('code');
            $('#emp_code').empty()
            $('#mobile').empty()
            $('#des').empty()
            $('#name').empty()
            $('#employee_id').empty()

            if(status_id!='') {
                $('.page-loader-wrapper').fadeIn();
                $.ajax({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    type: "POST",
                    url: "<?php echo e(route('get_employee_details')); ?>",
                    dataType: 'json',
                    data: {'code': code},
                    success: function (data) {
                        $('.page-loader-wrapper').fadeOut();
                        if (data.msg == 'success') {
                            $('#emp_code').append(data.data.employee_code)
                            $('#mobile').append(data.data.mobile)
                            $('#des').append(data.data.designation_name)
                            $('#name').append(data.data.name)
                            $('#service_status_id').val(status_id)
                            $('#employee_id').val(code)
                            $('#fluidModalTopTerminated').modal('show')
                        }

                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        $('.page-loader-wrapper').fadeOut();


                        Swal.fire({
                            type: 'error',
                            title: 'Oops...',
                            text: 'Something went wrong!',


                        })
                    }
                })
            }


        })

        $(document).on('submit','#service_form',function (e) {
            e.preventDefault();


                swal({
                    title: 'Are you sure?',
                    text: "This Employee is posted as per HCMS system ?",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',

                    confirmButtonText: "CONFIRM",
                    cancelButtonText: "CANCEL"
                }).then((result) => {
                    if (result.value)
                {
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        },
                        type: "POST",
                        url: "<?php echo e(route('employeeVerificationYes')); ?>",
                        dataType: 'json',
                        data: {'code': code},
                        success: function (data) {
                            if (data.msg == 'success') {

                                swal("Success!", "Thank you for verifying employee current posting", "success");
                                $('.verification').DataTable().ajax.reload();
                            }
                            if (data.msg == 'failed') {

                                Swal.fire({
                                    type: 'error',
                                    title: 'Oops...',
                                    text: 'Something went wrong!'
                                })
                            }
                        },
                        error: function (jqXHR, textStatus, errorThrown) {

                            Swal.fire({
                                type: 'error',
                                title: 'Oops...',
                                text: 'Something went wrong!',

                            })
                        }
                    })
                }
            })





        });


        $('#fluidModalTopTerminated').on('hidden.bs.modal', function () {
            $('.status').val('')
        })

        $(document).on('click','#submit_service',function (e) {
            e.preventDefault();
            var service_id=$('#service_status_id').val();
            var
        })

    </script>


        <?php $__env->stopSection(); ?>



<?php echo $__env->make('layouts.app2', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>