<!-- Main Content -->

<div class="page-wrapper">

    <div class="container-fluid pt-25">

        <div class="row">

            <div class="col-md-12">

                <div class="alert alert-success alert-dismissible" role="alert" <?php if($this->session->flashdata('message')==''){ ?> style="display:none" <?php } ?> >

                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>

                    <?php echo $this->session->flashdata('message'); ?>

                </div>

            </div>

        </div>

        <!-- Row -->

        <div class="row">

            <div class="col-sm-12">

                <div class="panel panel-default card-view">

                    <div class="panel-heading">

                        <div class="pull-left">

                            <h6 class="panel-title txt-dark">Notify User List</h6>

                        </div>

                        <div class="clearfix"></div>

                    </div>

                    <div class="panel-wrapper collapse in">

                        <div class="panel-body">

                            <div class="table-wrap">

                                <div class="table-responsive">

                                    <table id="datable_1" class="table table-bordered table-striped">

                                        <thead>

                                            <tr>

                                                <th>Sr. No.</th>

                                                <th>Date</th>

                                                <th>Email</th>

                                                <th>Mobile No.</th>

                                                <th>Action</th>

                                            </tr>

                                        </thead>

                                        <tbody>

                                            <?php 

                                             if($users){ foreach ($users as $key => $value) : ?>

                                                <tr id="<?php echo "product_notify_".$value['id']; ?>">

                                                    <td><?php echo ($key+1); ?></td>

                                                    <td><?php echo $value['date']; ?></td>

                                                    <td><?php echo $value['email']; ?></td>

                                                    <td><?php echo $value['mobile_no']; ?></td>

                                                    <th><a href="javascript:void(0)" class="ajax_delete" data-table="product_notify" data-value="<?php echo "id_".$value['id']; ?>"> <i class="fa fa-trash-o fa-lg"></i></a></th>

                                                </tr>

                                            <?php endforeach; } ?>

                                        </tbody>

                                    </table>

                                </div>

                            </div>

                        </div>

                    </div>

                </div>  

            </div>

        </div>

        <!-- /Row -->

    </div>

<script type="text/javascript">

    var site_url = "<?php echo base_url(); ?>";
    var urlLink = "<?php echo A; ?>";

    $(".ajax_delete").on("click",function(){

        var id = $(this).attr("data-value");

        var split = id.split("_");

        //alert(split[0]);

        var table = $(this).attr("data-table");

        var image = ($(this).attr("data-image")=="undefined")?"":$(this).attr("data-image");

        var result = confirm("Really want to delete?");

        if(result) {

            $.ajax({

                url: site_url+urlLink+"/ajaxDelete",

                type: "POST",

                data: split[0]+"="+split[1]+"&table="+table+"&image="+image,

                success: function(result){

                    if(result==1)

                    {

                        $("#"+table+"_"+split[1]).remove();

                    }

                }

            });

        }

    });
</script>
