<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color"><?php echo $title; ?> - List</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    <?php $general = get_general_setting();?>
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <!-- /.box -->
                <div class="box box-primary">
                    <div class="box-body table-responsive">
                    <?php if(!empty($success)) {?>
                        <div class="alert alert-success alert-dismissable">
                            <i class="fa fa-thumbs-o-up"></i>
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            <h4><?php echo $success;?></h4>
                        </div>
                    <?php }
                    else if(!empty($error)) {?>
                        <div class="alert alert-danger alert-dismissable">
                            <i class="fa fa-thumbs-o-down"></i>
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            <h4><?php echo $error;?></h4>
                        </div>
                    <?php }?>
                        <div class="row">
                            <div class="left-col action-left-col">
                                <?php if (in_array(2, $permission)) {?>
                                    <a href="<?php echo $add_link?>">
                                        <input type="button" class="btn btn-success btn-sm" value="<?php echo $add_btn?>" />
                                    </a>
                                <?php }?>
                            </div>
                        </div>      
                    </div>
                    <div class="box-body table-responsive">
                        <table id="dt_basic" class="table table-striped table-bordered table-hover" width="100%">
                            <thead>
                                <tr>
                                    <th data-class="expand">S.No</th>
                                    <th>Receipt No</th>
                                    <th data-hide="phone,tablet">Name (E)</th>
                                    <th data-hide="phone,tablet">Name (T)</th>
                                    <th data-hide="phone,tablet">Contact No</th>
                                    <th data-hide="phone,tablet">Type</th>
                                    <th data-hide="phone,tablet">Amount</th>
                                    <th data-hide="phone" style="text-align:center; min-width: 225px;" width="15%">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($results as $key => $row) :
                                    $style = ($row->status == 2) ? 'style="color: red;"' : '';
                                    $disabled = ($row->status == 2) ? 'style="cursor: no-drop"' : '';
                                    $tooltip = ($row->status == 2) ? $row->del_reason : '';
                                ?>
                                    <tr <?php echo $style;?> data-toggle="tooltip" data-placement="auto" title="<?php echo $tooltip;?>">
                                        <td><?php echo ++ $key;?></td>
                                        <td><?php echo (($general->prefix == 1) ? $row->prefix : '') . $row->receipt_no;?></td>
                                        <td><?php echo text($row->name);?></td>
                                        <td><?php echo (!empty($row->tamil_name)) ? '<span class="lang-tamil">' . $row->tamil_name. '</span>' : 'N/A';?></td>
                                        <td><?php echo text($row->contact_no);?></td>
                                        <td><?php echo text($row->service);?></td>
                                        <td align="right"><?php echo text($row->d_amount);?></td>
                                        <td align="center" class="td_action">
                                            <a class="label btn btn-info" href="<?php echo $print . $row->id . '/' . $menu_id; ?>" style="background-color: #00a65a; border-color: #00a65a;">
                                                <span>Print</span>
                                            </a>
                                            <?php if (in_array(1, $permission)) {?>
                                                <a class="label btn btn-warning view" href="<?php echo $view_link . $row->id . '/' . $menu_id;?>">
                                                    <span>View</span>
                                                </a>
                                            <?php }?>
                                            <input type="hidden" name="auto_id" class="auto_id" value="<?php echo $row->id;?>" />
                                            <?php if (in_array(3, $permission)) {?>
                                                <?php if((!empty($row->d_id) && $row->id == $row->d_id) && (date('d-m-Y',strtotime($row->created_on)) == date('d-m-Y'))) { ?>
                                                    <?php if($row->status == 1) { ?>
                                                        <a class="label btn btn-primary edit edit_otp" href="<?php echo $edit_link . $row->id . '/' . $menu_id;?>" data-otp-ids="<?php echo form_prep(serialize($service_menu_id));?>">
                                                            <span>Edit</span>
                                                        </a>
                                                    <?php } else {?>
                                                        <a class="label btn btn-primary edit" <?php echo $disabled;?>>
                                                            <span>Edit</span>
                                                        </a>
                                                    <?php } ?>
                                                <?php } else {?>
                                                    <a class="label btn btn-primary edit" href="#" style="cursor: no-drop;" disabled >
                                                        <span>Edit</span>
                                                    </a>
                                                <?php } ?>
                                            <?php }?>
                                            
                                            <?php if (in_array(4, $permission)) {?>
                                                <?php if((!empty($row->d_id) && $row->id == $row->d_id) && (date('d-m-Y',strtotime($row->created_on)) == date('d-m-Y'))) { ?>
                                                    <?php if($row->status == 1) { ?>
                                                        <a class="label btn btn-danger pop_up_confirm delete delete_otp" data-confirm="Do you want to delete <b><?php echo $row->name;?></b> from donation?" data-href="<?php echo $delete_link . $row->id . '/' . $menu_id;?>" data-otp-ids="<?php echo form_prep(serialize($service_menu_id));?>">
                                                            <span>Delete</span>
                                                        </a>
                                                    <?php } else {?>
                                                        <a class="label btn btn-danger delete" <?php echo $disabled;?>>
                                                            <span>Delete</span>
                                                        </a>
                                                    <?php } ?>
                                                <?php } else {?>
                                                    <a class="label btn btn-danger delete" href="#" style="cursor: no-drop;" disabled >
                                                        <span>Delete</span>
                                                    </a>
                                                <?php } ?>
                                            <?php }?>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div>
        
        <!-- Start Modal -->
        <div class="modal fade" id="otp-dialog" role="dialog">
            <div class="modal-dialog">
                <!-- Modal content-->
                <div class="modal-content">

                    <div class="modal-header" style="background-color: #337AB7;">
                        <button type="button" class="close cancel_popup" data-dismiss="modal" style="color: #FFF;">x</button>
                        <h4 class="modal-title" style="color: #FFF;">OTP</h4>
                    </div>
                    <div class="modal-body col-xs-12" style="margin-bottom: 30px; border-bottom: 1px dotted #1ba;">
                        <form name="m">
                            <input type="hidden" class="hidden_id" />
                            <input type="hidden" class="edit_link" data-edit-link="<?php echo (!empty($edit_link)) ? $edit_link : '';?>" />
                            <ul class="error_container" style="display:block;padding-left: 50%;"></ul>
                            <div class="col-xs-12">
                                <div class="col-xs-3">&nbsp;</div>                        
                                <div class="col-xs-1">
                                    <label style="padding-top: 31%;">OTP</label>
                                </div>
                                <div class="col-xs-6">
                                    <input type="text" class="form-control otp_no" name="otp_no" value="" />
                                </div>
                                <div class="col-xs-3">&nbsp;</div>
                            </div>
                        </form>
                    </div>

                    <div class="modal-footer" style="padding-right: 30px;">
                        <button type="button" class="btn btn-primary otp_btn_cancel" data-dismiss="modal"><i class="fa fa-play-circle-o"></i> Later</button>
                        <button type="submit" id="sbmt-btn" class="btn btn-danger"><i class="fa fa-send"></i> Send</button>
                    </div>
                </div>   <!-- Modal Content -->     
            </div> 
        </div> <!-- OTP Dialog -->
        
        <!-- Start Modal -->
        <div class="modal fade" id="warning-dialog" role="dialog">
            <div class="modal-dialog">
                <!-- Modal content-->
                <div class="modal-content">

                    <div class="modal-header" style="background-color: #337AB7;">
                        <button type="button" class="close cancel_popup" data-dismiss="modal" style="color: #FFF;">x</button>
                        <h4 class="modal-title" style="color: #FFF;">Warning: Mis-match module is found</h4>
                    </div>
                    <div class="modal-body col-xs-12" style="margin-bottom: 30px; border-bottom: 1px dotted #1ba;">
                        <form name="m">
                            <input type="hidden" class="correct_url" name="correct_url" /> 
                            <div class="col-xs-12 warning_content"></div>
                        </form>
                    </div>

                    <div class="modal-footer" style="padding-right: 30px;">
                        <button type="submit" id="sbmt-btn" class="btn btn-danger"><i class="fa fa-history"></i> Redirect Now</button>
                        <button type="button" class="btn btn-primary redirect_btn_cancel" data-dismiss="modal"><i class="fa fa-play-circle-o"></i> Later</button>                        
                    </div>
                </div>   <!-- Modal Content -->     
            </div> 
        </div> <!-- Dialog -->
        
    </section><!-- /.content -->
</aside><!-- /.right-side -->
<!-- ./wrapper -->
<script type="text/javascript" src="<?php echo js_url();?>library/datatables.responsive.min.js"></script>
<script src="<?php echo base_url();?>assets/js/library/jquery.dataTables.min.js"></script>
<script>
    $(document).ready(function() {
        /* BASIC ;*/
        var responsiveHelper_dt_basic = undefined;
        
        var breakpointDefinition = {
            tablet : 1024,
            phone : 480
        };

        $('#dt_basic').dataTable({
            "autoWidth" : true,
            "preDrawCallback" : function() {
                // Initialize the responsive datatables helper once.
                if (!responsiveHelper_dt_basic) {
                    responsiveHelper_dt_basic = new ResponsiveDatatablesHelper($('#dt_basic'), breakpointDefinition);
                }
            },
            "rowCallback" : function(nRow) {
                responsiveHelper_dt_basic.createExpandIcon(nRow);
            },
            "drawCallback" : function(oSettings) {
                responsiveHelper_dt_basic.respond();
            }
        });
        $('select[name="dt_basic_length"], input[type="search"]').removeClass();
        $('input[type="search"]').css('-webkit-appearance','textfield');
	    /* END BASIC */
    });
    
</script>