<form id="validation-form33" novalidate="novalidate" method="POST" action="/{{projectUrl()}}transferTempBill"> 
<div class="form-group col-md-4">
<select class="form-control" name="Consultant" required>
            <option value="" selected disabled>Search Consultant</option>
                @foreach($consultantList as $result)
                <option value="{{$result->id}}">{{$result->Name}}</option>
                @endforeach
            </select>
</div>
<table id="example" class="table table-striped table-bordered dt-responsive nowrap" style="width:100%">
    <thead>
        <tr>
            <th>#</th>
            <th>Bill No</th>
           
            <th>Mrd. No</th>
            <th>Patient Name</th>
            <th>Age/Gender</th>
            <th>Bill Date</th>
            <th>Bill Type</th>
            <th>Operation Date</th>
            <th>Paid Amount</th>
            <th>Action</th>
            
        </tr>
    </thead>
    <tbody>
        @foreach($data as $result)
        <tr>
            <td><input type="checkbox" id="sbchk{{$result->id}}" class="common_selector Proccedures" value="{{$result->id}}" 
            onclick="featured({{$result->id}})"></td>
            <input type="hidden" id="chkvalue{{$result->id}}" name="chkvalue[]" value="0">
<input type="hidden" name="BillId[]" value="{{$result->id}}">
@csrf
            <td>{{$result->id}}</td>
            <td>{{$result->MrdNo}}</td>
            <td>{{$result->PatientName}}</td>
            <td>{{$result->AgeGender}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->BillDate)))}}</td>
            <td>{{$result->BillType}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->AdmissionDate)))}}</td>
          
            <td>&#8377;{{$result->PaidAmt}}</td>
            <td>
            <a href='editTempBill/{{$result->id}}' data-toggle="tooltip" data-placement="top" title="Edit" data-original-title="Edit" class="update"><i class="lnr lnr-pencil mr-2"></i></a>&nbsp;&nbsp;
                <a data-id="{{$result->id}}" href='javascript:void(0);' data-toggle="tooltip" data-placement="top"
                    title="Delete" data-original-title="Delete" class="delete" id="bootbox-confirm"><i
                        class="lnr lnr-trash text-danger"></i></a>
            </td>
        </tr>
        @endforeach
    </tbody>
</table>
<button class="btn btn-success" type="submit" name="makesubmitbtn" id="submit">Transfer</button> 
</form>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable({
        "scrollX": true,
        dom: 'Bfrtip',
        buttons: [

            'excelHtml5'

        ]
    });

    $('#validation-form33').on('submit', function(e) {
        //e.preventDefault();
        exit();
        alert("ok");
        $.ajax({
                url: "{{ url('transferTempBill') }}",
                method: "POST",
                data: new FormData(this),
                contentType: false,
                processData: false,
                beforeSend: function() {
                    $('#submit').attr('disabled', 'disabled');
                    $('#submit').text('Please Wait...');
                },
                success: function(data) {
                    console.log(data);
                    $('#submit').attr('disabled', false);
                    $('#submit').text('Transfer');
                }

            });
    });

});

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