<div class="form-group col-sm-12">  
    <?php echo validation_errors(); ?>
    <form id="formID4" action="<?php echo base_url(); ?>super_admin_student/save_student_payment_information" method="post" name="userForm" enctype="multipart/form-data" >
        <!--Some Required Hidden Value -->
        <input type="hidden" name="person_id" value="<?php echo $person_id; ?>">
        <input type="hidden" name="course_batch_id" value="<?php echo $course_batch_id; ?>">
        <input type="hidden" name="coupon_id" value="<?php echo $this->session->userdata('coupon_id'); ?>">

        <br>
        <br>
        <div class="form-group col-sm-12" id="">
            <div class="form-group col-sm-4">
                <label for="invoice_number">Invoice No:</label>
                <input data-errormessage-value-missing="Course Category is required!" 
                       class="form-control validate[required] text-input"
                       type="text" name="invoice_number" value="<?php echo rand(1000, 9999); ?>">
            </div>
        </div>

        <div class="form-group col-sm-12" id="">
            <div class="form-group col-sm-4">
                <label for="payment_name">Payment Name<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Course Category is required!" 
                           class="form-control validate[required] text-input"
                           name="payment_name" id="payment_name" value="<?php
                           if ($person_info) {
                               echo $person_info->person_first_name;
                           } else {
                               echo set_value('person_first_name');
                           }
                           ?>" >
                </div>
            </div>
            <div class="form-group col-sm-4">
                <label for="unit_price">Unit Price<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Unit Price is required!" 
                           class="form-control validate[required] text-input"
                           name="unit_price" id="unit_price" value="<?php
                           if ($course_info) {
                               echo $course_info->course_price;
                           }
                           ?>" >
                </div>
            </div>
            <div class="form-group col-sm-4">
                <label for="total_price">Total Price<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Total Price is required!" 
                           class="form-control validate[required] text-input"
                           name="total_price" id="total_price" value="<?php
                           if ($course_info) {
                               echo $course_info->course_price;
                           }
                           ?>" >
                </div>
            </div>
            <div class="form-group col-sm-4">
                <label for="payment_amount">Payment Amount<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Payment Amount is required!" 
                           class="form-control validate[required] text-input"
                           name="payment_amount" id="payment_amount" value="" >
                </div>
            </div>
            <div class="form-group col-sm-4">
                <label for="payment_method">Payment Method<span style="color: red">*</span></label>
                <div class="controls">
                    <select data-errormessage-value-missing="Payment Method is required!" 
                            class="form-control validate[required] text-input"
                            name="payment_method" id="payment_method" onchange="manupulatePaymentForm();">
                        <option value="">select Payment Method</option>
                        <option value="1">Paypal</option>
                        <option value="2">Credit Card</option>
                        <option value="3">Account Pay</option>
                        <option value="4">bKash</option>
                        <option value="5">Hand Cash</option>
                    </select>
                </div>
                <script>
                    function manupulatePaymentForm() {
                        paymentMethod = document.getElementById('payment_method').value;

                        serverPage = '<?php echo base_url(); ?>super_admin_student/manupulate_payment_form/' + paymentMethod;
                        xmlhttp.open("GET", serverPage);
                        xmlhttp.onreadystatechange = function ()
                        {
                            if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                            {
                                document.getElementById('payment_form').innerHTML = xmlhttp.responseText;
                            }
                        }
                        xmlhttp.send(null);
                    }
                </script>
            </div>
        </div>

        <div class="" id="payment_form"></div>

        <div class="form-group col-sm-12" id="">
            <div class="form-group col-sm-5">
                <label for="paid_on">Payment On<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Payment Method is required!" 
                           class="form-control validate[required] text-input" type="date" name="paid_on" id="paid_on" value="">
                </div>
            </div>
            <div class="form-group col-sm-5">
                <label for="due_date">Due Payment Date<span style="color: red">*</span></label>
                <div class="controls">
                    <input data-errormessage-value-missing="Payment Method is required!" 
                           class="form-control validate[required] text-input" type="date" name="due_date" id="due_date" value="<?php echo date('Y-m-d'); ?>">
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12" id="">
            <div class="form-group col-sm-6">
                <label for="payment_description">Payment Description </label>
                <textarea name="payment_description" class="form-control texteditor" ><?php echo set_value('payment_description'); ?></textarea>
            </div>
        </div>

        <div class="checkbox col-sm-6">
            <?php if ($person_id && $course_batch_id) { ?>
                <button type="submit" id="submit3" class="btn btn-default">Submit</button>
                <button type="reset" class="btn btn-default">Reset</button>
            <?php } ?>

        </div>
    </form>
</div>
