<?php
  
    $base_doctors=[];
    if(!empty($doctors)){
        foreach($doctors as $d){
            $base_doctors[$d['base_id']][]=$d;
        }
    }
    $base = $db->selectAll('base');

    $general->pageHeader($rModule['title']);
?>
<div class="row">
    <div class="col-sm-12">
        <div class="white-box">
            <div class="row">
                <div class="col-sm-12 col-lg-12">   
                   
                    <?php
                        $general->inputBoxSelectForReport($base,'Base','base_id','id','title');    
                    ?>


                    <div class="col-md-2">
                        <h5 class="box-title">Search</h5>
                        <button class="btn btn-success" onclick="doctor_list()">Search</button>
                        <script type="text/javascript">      
                            
                            function doctor_list(){
                                let base_id = $('#base_id').val();
                                $('#reportArea').html(loadingImage);
                                const doctor_list_data={doctor_list:1,base_id:base_id};
                                $.ajax({
                                    type:'post',
                                    url:ajUrl,
                                    data:doctor_list_data,
                                    success:function(data){
                                        $('#reportArea').html('');
                                        if(typeof(data.status)!=='undefined'){
                                            if(data.status==1){
                                                $('#reportArea').html(data.html);
                                            }
                                            swMessageFromJs(data.m);
                                        }
                                        else{
                                            swMessage(AJAX_ERROR_MESSAGE); 
                                        }
                                    },
                                    error:function(){
                                        $('#reportArea').html('');
                                        swMessage(AJAX_ERROR_MESSAGE); 
                                    }
                                });
                            }
                            $(document).ready(function(){
                                doctor_list();
                            });
                        </script>
                    </div>
                </div>
                <div class="col-sm-12 col-lg-12">
                    <?php
                        show_msg();
                    ?>
                </div>
                <div class="col-sm-12 col-lg-12" id="reportArea" style="overflow: auto;"></div>
            </div>
        </div>
    </div>
</div> 