<?php
$code = '';
if (isset($_GET['customer_code'])) {
    $code = $_GET['customer_code'];
}
if($code!=''){
    ?>
    <script>
        $(document).ready(function (){
            customer_search();
        })
    </script>
    <?php
}
?>
<h4 class="mb-3"> Customer Search by Customer ID </h4>

<div class="row">
    <div class="col-md-4">
        <div class="mb-2">
            <label for="searchBy">Search By</label>
            <select class="form-control" id="search_by">
                <option value="id">Customer ID</option>
                <option value="mobile">Customer Mobile</option>
            </select>
        </div>
    </div>
    <div class="col-md-5">
        <div class="mb-2">
            <label for="firstName">Customer ID</label>
            <input type="text" class="form-control" id="customer_code" value="<?= $code ?>">
        </div>
    </div>
    <div class="col-md-3">
        <button type="button" id="customer_search" class="btn btn-success" style="margin-top: 25px;"><i class="fa fa-search"></i> Search Customer</button>
    </div>
</div>
<div class="row" id="customer_details_area" style="display:none">
    <div class="col-md-12">
        <div class="student-data mt-3">
            <div class="table-responsive bg-white p-3">
                <h5>Customer Information</h5>
                <table class="table table-bordered table-dark-bordered">
                    <tbody id="customer_details">
                        <tr>
                            <th style="width: 120px;">Customer ID</th>
                            <td style="width: 5px;">:</td>
                            <td>
                                <input type="hidden" class="input_id">
                                <span class="id"></span>
                            </td>
                            <th style="width: 120px;">Name</th>
                            <td style="width: 5px;">:</td>
                            <td>
                                <span class="name"></span>
                            </td>
                        </tr>
                        <tr>

                            <th style="width: 120px;">Mobile</th>
                            <td style="width: 5px;">:</td>
                            <td>
                                <span class="mobile"></span>
                            </td>
                            <th style="width: 120px;">Address</th>
                            <td style="width: 5px;">:</td>
                            <td>
                                <span class="address"></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>