<form method="post" action="/{{projectUrl()}}saveMakeOrder">  
    @csrf
<table id="example" class="table table-striped table-bordered dt-responsive nowrap" style="width:100%">
    <thead>
        <tr>
            <th>#</th>
            <th>Bill No</th>
            <th>Bill Date</th>
            <th>Patient Name</th>
            <th>Mob</th>
            <th>Bill Amount</th>
        </tr>
    </thead>
    <tbody>
        @foreach($data as $result)
        <tr>

            <td><input type="checkbox" id="sbchk{{$result->id}}" class="common_selector Proccedures" value="{{$result->id}}" 
            <?php if($result->MakeOrder == 1) {?> checked <?php } ?> onclick="featured({{$result->id}})"
            >
            <input type="hidden" id="chkvalue{{$result->id}}" name="chkvalue[]" value="0">
            <input type="hidden" name="BillId[]" value="{{$result->id}}">
            </td>
            <td>{{$result->BillNo}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->SaleDate)))}}</td>
            <td>{{$result->PatientName}}</td>
            <td>{{$result->MobileNo}}</td>
            <td>&#8377;{{number_format($result->SubTotal,2)}}</td>
        </tr>
        @endforeach

    </tbody>
</table>
<br>
<button class="btn btn-success" type="submit" name="makesubmitbtn" id="submit" style="display: none;">Make
    Order</button>
    </form>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable({
        "scrollX": true,
        dom: 'Bfrtip',
        "pageLength": 200,
        "order": [
            [0, "desc"]
        ],
        buttons: [

            'excelHtml5'

        ]
    });

    function get_filter(class_name)
    {
        var filter = [];
        $('.'+class_name+':checked').each(function(){
            filter.push($(this).val());
        });
        return filter;
    }

    $('.common_selector').click(function(){
        //filter_data();
        var ProccedureId = get_filter('Proccedures');
         if(ProccedureId == ''){
              $('#submit').hide();
         }
         else{
        $('#submit').show();
         }
        
    });
});

function featured(id){
  if($('#sbchk'+id).prop('checked') == true) {
            $('#chkvalue'+id).val(1);
        }
        else{
           $('#chkvalue'+id).val(0);
            }
        
}
</script>