<div class="row">
    <div class="col-md-12">
                                
        <div id="change_rate" class="modal fade" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">Change <?php echo $rate_details->item_name; ?></h4>
                    </div>
                    <form id="change_rate_item" class="form-horizontal" method="post">
                        <input type="hidden" id="rate_id" name="rate_id" value="<?php echo $rate_details->id; ?>">
                        <div class="modal-body">
                            <div id="response_msg_modal"></div>
                            <div class="scroller" style="height:300px" data-always-visible="1" data-rail-visible1="1">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="form-body">
                                            <div class="row form-group">
                                                <label class="col-md-3 control-label pull-left">Current Rate</label>
                                                <div class="col-md-6">
                                                    <input type="number" name="current_rate" id="current_rate" placeholder="123.00" class="form-control"/>
                                                </div>
                                            </div>
                                            <div class="row form-group">
                                                <label class="col-md-3 control-label pull-left">Description</label>
                                                <div class="col-md-6">
                                                    <select class="form-control" name="description" id="rate_change_description">
                                                        <option value="Market Price">Market Price</option>
                                                        <option value="Other">Other</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="row form-group hidden" id="div_other_description">
                                                <label class="col-md-3 control-label pull-left">Other Description</label>
                                                <div class="col-md-6">
                                                    <textarea name="other_description" id="other_description" class="form-control"></textarea>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" data-dismiss="modal" class="btn default">Close</button>
                            <button type="submit" class="btn green">Save changes</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
                                
        <div class="modal fade" id="success_modal_admin" tabindex="-1" role="basic" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">Success!</h4>
                    </div>
                    <div class="modal-body">
                        <?php echo $rate_details->item_name; ?> Changed Successfully
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn green" data-dismiss="modal" onclick="window.location.reload()">Ok</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
                                
        <div class="modal fade" id="success_modal" tabindex="-1" role="basic" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">Success!</h4>
                    </div>
                    <div class="modal-body">
                        <?php echo $rate_details->item_name; ?> Change Approval Sent Successfully
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn green" data-dismiss="modal" onclick="window.location.reload()">Ok</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        
        <div class="pull-right">
            <a class="btn default green-stripe"  data-toggle="modal" href="#change_rate"> Change <?php echo $rate_details->item_name; ?></a>
        </div>
        <h4>Rate Details</h4>
        <hr>
        <div class="col-md-offset-2 col-md-8">
            <div id="response_msg"></div>

            <table class="table table-hover table-bordered table-striped" style="font-size: initial;">
                <tr>
                    <td>
                        <strong><?php echo $rate_details->item_name; ?> </strong>
                    </td>
                    <td>
                        <strong><?php echo 'Rs. '.number_format($rate_details->item_rate,2,'.',','); ?></strong>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Last Updated On </strong>
                    </td>
                    <td>
                        <strong><?php echo $rate_details->updated_on; ?></strong>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Last Updated By </strong>
                    </td>
                    <td>
                        <strong>
                            <?php
                            $admin_details = $this->admin_db->get_admin_detail($rate_details->updated_by);    
                            
                            echo $admin_details->contact_name.' - '.$admin_details->user_privilege;
                            
                            ?>
                        </strong>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="col-md-12">

        <h4>Rate Logs</h4>
        <hr>
                                                
        <script type="text/javascript" language="javascript" >
            $(document).ready(function () {
                var dataTable = $('#rate_item_logs').DataTable({
                    order: [[ 0, "desc" ]],
                    select: true,
                    pageLength: 10,
                    processing: true,
                    serverSide: true,
                    ajax: {
                        url: "Json_data/json_data_records?json_type=rate_item_logs&rate_id=<?php echo $rate_details->id; ?>", // json datasource
                        type: "post", // method  , by default get
                        error: function () {  // error handling
                            $(".employee-grid-error").html("");
                            $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="6">No data found in the server</th></tr></tbody>');
                            $("#employee-grid_processing").css("display", "none");

                        }
                    }, "aoColumns": [
                        {"sTitle": "", "sClass": "hidden"},
                        {"sTitle": "#"},
                        {"sTitle": "Status"},
                        {"sTitle": "Rate Amount"},
                        {"sTitle": "Description"},
                        {"sTitle": "Updated By"},
                        {"sTitle": "Updated On"},
                    ], "fnCreatedRow": function (nRow, aData, iDataIndex) {
                        $(nRow).attr('id', '' + aData[0]);

                    }
                });

            });
        </script>
        
        <table id="rate_item_logs" class="table table-striped table-bordered table-hover"></table>
    </div>
</div>