<script type="text/javascript">
    $(document).ready(function(){
        $("#address").hide();
        $("#smsg").hide();
        $("#emsg").hide();
        $("#edit").click(function(){
            $("#address").show();
            $("#address_sublocality").focus();
        });
    });
    function onBoardClinic(id){
        $.ajax({
            url: "clinicdetail.php",
            data: 'act=OnBoard&id='+id,
            method: 'POST',
            success: function(response){
               res = JSON.parse(response);
               if(res.error){
                  $("#emsg").html(res.msg);  
                  $("#emsg").show();  
                  return false;
               }else{
                  location.reload();  
               }
            }
        });
    }

    function validate_address(){

   if($("#address_street").val()==''){
        $("#address_street").addClass('error');
        $("#address_street").focus();
        $("#msg_address_street").html('Please enter street').show();
        return false;
    }else{
        $("#address_street").removeClass('error');
        $("#msg_address_street").hide();
    }
   if($("#address_route").val()==''){
        $("#address_route").addClass('error');
        $("#address_route").focus();
        $("#msg_address_route").html('Please enter route').show();
        return false;
    }else{
        $("#address_route").removeClass('error');
        $("#msg_address_route").hide();
    }
    if($("#address_sublocality").val()==''){
        $("#address_sublocality").addClass('error');
        $("#address_sublocality").focus();
        $("#msg_address_sublocality").html('Please enter Sublocality').show();
        return false;
    }else{
        $("#address_sublocality").removeClass('error');
        $("#msg_address_sublocality").hide();
    }

    if($("#address_locality").val()==''){
        $("#address_locality").addClass('error');
        $("#address_locality").focus();
        $("#msg_address_locality").html('Please enter Locality').show();
        return false;
    }else{
        $("#address_locality").removeClass('error');
        $("#msg_address_locality").hide();
    }

    if($("#address_postal").val()==''){
        $("#address_postal").addClass('error');
        $("#address_postal").focus();
        $("#msg_address_postal").html('Please enter postal').show();
        return false;
    }else{
        $("#address_postal").removeClass('error');
        $("#msg_address_postal").hide();
    }
    if($("#address_level_1").val()==''){
        $("#address_level_1").addClass('error');
        $("#address_level_1").focus();
        $("#msg_address_level_1").html('Please enter address Level 1').show();
        return false;
    }else{
        $("#address_level_1").removeClass('error');
        $("#msg_address_level_1").hide();
    }

    if($("#address_level_1_short").val()==''){
        $("#address_level_1_short").addClass('error');
        $("#address_level_1_short").focus();
        $("#msg_address_level_1_short").html('Please enter address level 1 short').show();
        return false;
    }else{
        $("#address_level_1_short").removeClass('error');
        $("#msg_address_level_1_short").hide();
    }

    if($("#address_country").val()==''){
        $("#address_country").addClass('error');
        $("#address_country").focus();
        $("#msg_address_country").html('Please enter Country').show();
        return false;
    }else{
        $("#address_country").removeClass('error');
        $("#msg_address_country").hide();
    }

    
}
</script>
<div class="breadcrumb">
    <h1>Gurantor</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>/patientlist.php">Dashboard</a></li>
        <li>Gurantor Details</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></div>
<!-- <div class="widget-body">
    <div class="portlet-body">
                        
    <?php //echo ($clinicDetails->clinic_onBoard=='1') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>Clinic OnBoard done.</div>" : '' ; ?>
    <?php //echo ($clinicDetails->clinic_onBoard=='0') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>Clinic OnBoard pending.</div>" : '' ; ?>
    
   </div>
</div> -->
<div class="row">
   <div class="col-md-12">
       <div class="card">
        <div class="tab-content" id="myTabContent">
            <div class="tab-pane fade show active" id="invoice" role="tabpanel" aria-labelledby="invoice-tab">
                <div id="print-area">
                    <div class="row mb-5">
                        <div class="col-md-4 mb-3 mb-sm-0">
                            
                            <h5 class="font-weight-bold">Info</h5>
                            <b>Id</b> : <?php echo $patientDetails->patient_id ?><br/>
                            <b>First Name</b> : <?php echo w::d($patientDetails->patient_fname) ?><br/>
                            <b>Last Name</b> : <?php echo w::d($patientDetails->patient_lname) ?><br/>
                            <!-- <b>Gender</b> : <?php //echo w::d($patientDetails->patient_gender) ?><br/> -->
                            <!-- <b>PracticeId</b> : <?php //echo $patientDetails->guarantor_practice_id ?><br/> -->
                            <b>DOB</b> : <?php echo w::d($patientDetails->patient_dob) ?><br/>
                            <b>Email</b> : <?php echo w::d($patientDetails->patient_email_address) ?><br/>
                            <b>Phone</b> : <?php echo w::d($patientDetails->patient_phone) ?><br/>
                            <!-- <b>WorkPhone</b> : <?php //echo $patientDetails->guarantor_workphone ?><br/> -->
                        </div>
                        

                        <!-- <div class="col-md-4">
                            <h5 class="font-weight-bold">Clinic Info</h5>
                            <?php
                                $clinicObj = new clinic();
                                $where = array('clinic_id='=>$guarantorDetails->guarantor_clinic_id);
                                $data = array('where'=>$where);
                                $clinicDetails = $clinicObj->fromFields($data);

                            ?>
                            <b>Id</b> : <?php echo $clinicDetails->clinic_id ?> <br/>
                            <b>External Id</b> : <?php echo $clinicDetails->clinic_unique_id ?> <br/>
                            <b>Name</b> : <?php echo $clinicDetails->clinic_name?> <br/>
                            <b>Email</b> : <?php echo $clinicDetails->clinic_email ?>
                            <br/>
                            <b>Phone</b> : <?php echo $clinicDetails->clinic_phone ?>
                            <br/>
                            <b>Website</b> : <?php echo $clinicDetails->clinic_website ?><br/>
                            
                            <p></p>
                        </div> -->

                        <div class="col-md-4">
                            <h5 class="font-weight-bold">Appointment Info</h5>
                            <?php
                                $appointmentObj = new appointment();
                                $fields = array("COUNT(IF(appointment_status = 'scheduled', 1, NULL)) 'appscheduled'","COUNT(IF(appointment_status = 'completed', 1, NULL)) 'appcompleted'","COUNT(IF(appointment_status = 'requested', 1, NULL)) 'apprequested'","COUNT(IF(appointment_status = 'cancelled', 1, NULL)) 'appcancelled'");
                                //$where = array('appointment_patient_id='=>'13016');
                                $where = array('appointment_patient_id='=>$patientDetails->patient_id);
                                $data = array('fields'=>$fields,'where'=>$where);
                                $appointmentDetails = $appointmentObj->fromFields($data);
                                ?>
                                <br/>
                                <b>Appoinment Requested </b> : <?php echo $appointmentDetails->apprequested; ?>
                                <br/><br/>
                                <b>Appoinment Scheduled</b> : <?php echo $appointmentDetails->appscheduled; ?>
                                <br/><br/>
                                <b>Appoinment Completed</b> : <?php echo $appointmentDetails->appcompleted; ?>
                                <br/><br/>
                                <b>Appoinment Cancelled</b> : <?php echo $appointmentDetails->appcancelled; ?>
                                <br/>
                        
                            <p></p>
                        </div>
                    </div>
    </div>
   </div> 
</div>