<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <!-- <h1 class="m-0">Deactive Member </h1> -->
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Loan</a></li>
                    <li class="breadcrumb-item active">Loan Edit </li>
                </ol>
            </div>
        </div>
    </div>
</div>




<section class="content">
    <div class="container-fluid">




        <div class="row">

            <section class="col-lg-12 connectedSortable">

                <div class="card">
                    <div class="card-header " style="background-color:#31708e;color:white">
                        <h3 class="card-title">
                        Loan Edit Details
                        </h3>
                        <div class="card-tools">
                            <ul class="nav nav-pills ml-auto">
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="tab-content p-0">

                        <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>
                        <!-- <h1 class="text-center">Edit Loan</h1><br><br><br> -->
                        <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/update_loan" 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">
                                            <input type="text" class="form-control" name="me_no" id="mem_no" readonly value="<?php echo $loan['me_no'] . "-" . $loan['mem_name']; ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Loan Number</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_no" id="loan_no" value="<?php echo $loan['loan_no'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Loan Amount</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_amount" id="loan_amount" value="<?php echo $loan['loan_amount'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Loan OS Amount</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_os_amt" id="loan_os_amt" value="<?php echo $loan['loan_os_amt'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Loan Principal Amount</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_principle_amt" id="loan_principle_amt" value="<?php echo $loan['loan_principle_amt'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Current Instalment</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="curr_instalment" id="curr_instalment" value="<?php echo $loan['curr_instalment'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Total Instalment</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_instalment" id="loan_instalment" value="<?php echo $loan['loan_instalment'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Interest Rate</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_int_rate" id="loan_int_rate" value="<?php echo $loan['loan_int_rate'] ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>ML No. Of Days</b>&nbsp;&nbsp;&nbsp; <input type='checkbox' class='ml-5' <?php if ($loan['fst_int'] == 1) {
                                                                                                                                                echo "checked";
                                                                                                                                            } ?> name='fst_int' id='fst_int' value='1'><input type='hidden' class='ml-5' name='fst_int' id='fst_int_hidden' value='0'></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" value="<?php echo $loan['no_of_days']; ?>" name="no_of_days" id="no_of_days">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                <div class="col-sm-6"><b>FL Amount</b></div>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="f_loan_amount" id="f_loan_amount" value="<?php echo $loan['f_loan_amount']; ?>">
                </div>
            </div><br>
            <div class="row mt-3">
                <div class="col-sm-6"><b>FL OS Amount</b></div>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="f_os" id="f_os" value="<?php echo $loan['f_os']; ?>">
                </div>
            </div><br>
            <div class="row mt-3">
                <div class="col-sm-6"><b>FL Principal Amount</b></div>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="f_pri" id="f_pri" value="<?php echo $loan['f_pri']; ?>">
                </div>
            </div><br>
            <div class="row mt-3">
                <div class="col-sm-6"><b>FL Int Rate</b></div>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="f_int_rate" id="f_int_rate" value="<?php echo $loan['f_int_rate']; ?>">
                </div>
            </div><br>
            <div class="row mt-3">
                <div class="col-sm-6"><b>FL No. Of Days</b><input type='checkbox'  class='ml-5' name='f_fst_int' id='f_fst_int' <?php if ($loan['f_fst_int'] == 1) {
                                                                                                                                                echo "checked";
                                                                                                                                            } ?> value='1'><input type='hidden' class='ml-5' name='f_fst_int' id='f_fst_int_hidden' value='0'></div>
                <div class="col-sm-6">
                    <input type="text" class="form-control" <?php echo $checked; ?> name="f_no_of_days" id="f_no_of_days" value="<?php echo $loan['f_no_of_days']; ?>">
                </div>
            </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>ML Date</b></div>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="loan_date" id="loan_date" value="<?php echo date("d-m-Y"); ?>">
                                        </div>
                                    </div><br>
                                    <div class="row mt-3">
                                        <div class="col-sm-6"><b>Surety Member</b></div>
                                        <div class="col-sm-6">
                                            <select name="surety_memno" id="surety_memno" class="form-control">
                                                <option value="">All</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><br>
                                    <div class='row'>
                                        <div class='col-sm-5'></div>
                                        <button type="submit" onclick="check_validation();" class="btn btn-primary col-sm-2">Save</button>
                                    </div>
                                </form>
                            </div>
                        </div>

                   


                        </div>
                    </div>
                </div>
        </div>
</section>
</div>
</div>
</section>


            <script>
                function check_validation() {
                    if (document.getElementById("fst_int").checked) {
                        document.getElementById('fst_int_hidden').disabled = true;
                    }

                    if (document.getElementById("f_fst_int").checked) {
                        document.getElementById('f_fst_int_hidden').disabled = true;
                    }

                }
            </script>