<div id="page-wrapper">
<div class="header">
    <h1 class="page-header">

    </h1>
    <ol class="breadcrumb">
        <li><a href="#">Loan</a></li>
        <li class="active">Loan Close</li>
    </ol>

</div>
<div id="page-inner">



    <div class="row">
        <div class="col-md-12">
            <!--   Kitchen Sink -->
            <div class="panel panel-default">
                <div class="panel-heading d-flex justify-content-center">
                   Loan Close
                </div>
                <div class="panel-body">

                    <h3 class="text-center btn btn-lg btn-light  float-left"><a href="<?php echo base_url(); ?>index.php/Member/loan_details">Back</a></h3>
                   
                    <div class="row">
                        <div class="col-sm-3"></div>
                        <div class="col-sm-6">
                            <form method="post" action="<?php echo base_url(); ?>index.php/Member/loan_close" id="edit_loan" enctype='multipart/form-data'>
                                <input type="hidden" name="updated_on" value="<?php echo date("Y-m-d H:i:s"); ?>">
                                <div class="row mt-3">
                                    <div class="col-sm-6"><b>Member Number</b></div>
                                    <div class="col-sm-6">
                                        <select name="me_no" id="mem_no" required onchange="get_loan_close_details();" class="form-control">
                                            <option value="">-- Select --</option>
                                            <?php foreach ($members as $mem) { ?>
                                                <option value="<?php echo $mem['me_no']; ?>"><?php echo $mem['me_no'] . "-" . $mem['mem_name']; ?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                                <div id="loan_close_details">

                                </div>
                                <br>
                                <div class='row'>
                                    <div class='col-sm-5'></div>
                                    <button type="submit" class="btn btn-primary col-sm-2">Save</button>
                                </div>
                            </form>
                        </div>
                    </div>



                </div>


            </div>
        </div>
        <script>
            function get_total() {
                var total = parseInt($("#d_others").val()) + parseInt($("#d_ins").val()) + parseInt($("#p_int").val()) + parseInt($("#fp_int").val()) + parseInt($("#mt_int").val()) + parseInt($("#f_int").val()) + parseInt($("#mt_pri").val()) + parseInt($("#f_pri").val())

                $("#total_amt").val(total);
            }

            function get_loan_close_details() {
                var me_no = $("#mem_no").val();
                $.ajax({
                    type: 'POST',
                    url: "<?php echo base_url() ?>index.php/members/get_loan_close_details",
                    data: {
                        me_no: me_no
                    },
                    dataType: 'html',
                    success: function(data) {

                        $('#loan_close_details').html(data);
                    }
                });
            }
        </script>