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

    <div class="row gray">

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


            <div class="col-sm-6 col-sm-offset-3">

                <form action="#" method="post">
                    <div class="input-group">
                        <input type="text" class="form-control"  placeholder="Search here..." aria-describedby="basic-addon1">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                    </div>
                </form>

            </div>
        </div>

    </div>

    <div class="row ">
        <div class="col-sm-12">
            <h3 class="text-left">Pending list</h3>
            <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;font-weight: bold">

                <div class="col-sm-4 padding-zero" >Name</div>
                <div class="col-sm-5 padding-zero" >Email Address</div>
                <div class="col-sm-3 padding-zero" >Action</div>
            </div>
            <div class="col-sm-12"><br></div> 
            <?php if($group_pending_member){
                foreach($group_pending_member as $val){
                ?>
            <div class="col-sm-12 gray text-center" >
                <input type="hidden" name="url" id="url_id" value="<?php echo $grp_url;?>">
                <div class="col-sm-4 padding-zero" > <a href=""><?php  echo $pending_member_info[$val->group_member_id]->person_first_name.$pending_member_info[$val->group_member_id]->person_last_name;?></a></div>
                <div class="col-sm-5 padding-zero"> <?php  echo $pending_member_info[$val->group_member_id]->person_email;?></div>
                <div class="col-sm-3 padding-zero">
                    <?php 
                    $person_id = $this->session->userdata('person_id');
                   
                    if($person_info-> person_role==6||($group_id->group_created_by==$person_id&&$person_info-> person_role==1)){?>
                    <a href="javascript:;" onclick="approved('<?php echo  $val->group_member_id;?>','<?php echo $val->group_id;?>')"><i class="fa  fa-check-square" title="Approved"></i></a>&nbsp;&nbsp;
                    <a href="javascript:;" onclick="remove_requesting_group_member('<?php echo  $val->group_member_id;?>','<?php echo $val->group_id;?>') "><i class="fa fa-trash-o" title="Leave Group"></i></a>&nbsp;&nbsp;
                    <a href="javascript:;" id="block<?php echo  $val->group_member_id; ?>" onclick="blocked_requesting_group_member('<?php echo  $val->group_member_id;?>','<?php echo $val->group_id;?>')"><i class="fa  fa-lock" title="Blocked"></i></a>
                    <a href="javascript:;"  id="active<?php echo  $val->group_member_id; ?>" onclick="active_requesting_block_member('<?php echo  $val->group_member_id;?>','<?php echo $val->group_id;?>')" style="display:none;"><i class="fa  fa-user-plus" title="Active"></i></a>
                    <?php }?>

                </div>
            </div>
                <?php  } } ?>
            <div class="col-sm-12"><br></div> 

          

            <nav class="course-pagination">
                <ul class="pagination">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                        </a>
                    </li>
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true" title="Previous Page">&laquo;</span>
                        </a>
                    </li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true" title="Next Page">&raquo;</span>
                        </a>
                    </li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>

        </div>
    </div>
    <br>
    <div class="row gray">

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

            <div class="col-sm-12 text-left">
                <label><a href="<?php echo base_url() ?>super_admin">Dashboard </a>->><a href="<?php echo base_url() ?>super_admin_group/manage_group">Manage Group</a> ->> Requested Group Member Details</label>
            </div>    

        </div>

    </div>

    <br>
    <br>

</div> 
<script>
  function approved(group_member_id,group_id){
      swal({
                title: "", text: "Do you really want to Approve this member??",
                showCancelButton: true,
                confirmButtonColor: '#8CC73F',
                confirmButtonText: 'Yes',
                cancelButtonText: "No", closeOnConfirm: true,
                closeOnCancel: true
            },
            function (isConfirm) {
                if (isConfirm) {
         var xmlhttp2 = false;
        try {
            xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp2 = false;
            }
        }
        if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
            xmlhttp2 = new XMLHttpRequest();
        }
        
       
           
        var url='<?php echo base_url(); ?>' +'add-requesting-group-member';
            
           
            var formdata = new FormData();
            formdata.append("group_member_id", group_member_id);
            formdata.append("group_id", group_id);
          
        xmlhttp2.addEventListener("load", function () {
           var url=document.getElementById('url_id').value;
            window.location='<?php echo base_url(); ?>'+'pending-member-information/'+url;
          
            }, false);
            xmlhttp2.addEventListener("error", function () {
                alert("not upload");
            }, false);
            xmlhttp2.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp2.open("POST", url);
            xmlhttp2.send(formdata); 
                       }
      });

      
  }
  function remove_requesting_group_member(group_member_id,group_id){
  swal({
                title: "", text: "Do you really want to delete this member??",
                showCancelButton: true,
                confirmButtonColor: '#8CC73F',
                confirmButtonText: 'Yes',
                cancelButtonText: "No", closeOnConfirm: true,
                closeOnCancel: true
            },
            function (isConfirm) {
                if (isConfirm) {
         var xmlhttp2 = false;
        try {
            xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp2 = false;
            }
        }
        if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
            xmlhttp2 = new XMLHttpRequest();
        }
        
       
           
        var url='<?php echo base_url(); ?>' +'remove-requesting-group-member';
            
           
            var formdata = new FormData();
            formdata.append("group_member_id", group_member_id);
            formdata.append("group_id", group_id);
          
        xmlhttp2.addEventListener("load", function () {
           var url=document.getElementById('url_id').value;
            window.location='<?php echo base_url(); ?>'+'pending-member-information/'+url;
          
            }, false);
            xmlhttp2.addEventListener("error", function () {
                alert("not upload");
            }, false);
            xmlhttp2.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp2.open("POST", url);
            xmlhttp2.send(formdata); 
        }
      });
  }
  function block_requesting_group_member(group_member_id,group_id){
  swal({
                title: "", text: "Do you really want to delete this member??",
                showCancelButton: true,
                confirmButtonColor: '#8CC73F',
                confirmButtonText: 'Yes',
                cancelButtonText: "No", closeOnConfirm: true,
                closeOnCancel: true
            },
            function (isConfirm) {
                if (isConfirm) {
         var xmlhttp2 = false;
        try {
            xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp2 = false;
            }
        }
        if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
            xmlhttp2 = new XMLHttpRequest();
        }
        
       
           
        var url='<?php echo base_url(); ?>' +'block-requesting-group-member';
            
           
            var formdata = new FormData();
            formdata.append("group_member_id", group_member_id);
            formdata.append("group_id", group_id);
          
        xmlhttp2.addEventListener("load", function () {
           var url=document.getElementById('url_id').value;
            window.location='<?php echo base_url(); ?>'+'pending-member-information/'+url;
          
            }, false);
            xmlhttp2.addEventListener("error", function () {
                alert("not upload");
            }, false);
            xmlhttp2.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp2.open("POST", url);
            xmlhttp2.send(formdata); 
        }
      });
  }
 function blocked_requesting_group_member(group_member_id,group_id){
  swal({
                title: "", text: "Do you really want to delete this member??",
                showCancelButton: true,
                confirmButtonColor: '#8CC73F',
                confirmButtonText: 'Yes',
                cancelButtonText: "No", closeOnConfirm: true,
                closeOnCancel: true
            },
            function (isConfirm) {
                if (isConfirm) {
         var xmlhttp2 = false;
        try {
            xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp2 = false;
            }
        }
        if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
            xmlhttp2 = new XMLHttpRequest();
        }
        
       
           
        var url='<?php echo base_url(); ?>' +'block-requesting-group-member';
            
           
            var formdata = new FormData();
            formdata.append("group_member_id", group_member_id);
            formdata.append("group_id", group_id);
          
        xmlhttp2.addEventListener("load", function () {
         
           document.getElementById('active'+group_member_id).setAttribute('style','display:inline' );
           document.getElementById('block'+group_member_id).setAttribute('style','display:none' );
           
            
          
            }, false);
            xmlhttp2.addEventListener("error", function () {
                alert("not upload");
            }, false);
            xmlhttp2.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp2.open("POST", url);
            xmlhttp2.send(formdata); 
        }
      });
 }
 function active_requesting_block_member(group_member_id,group_id){
 swal({
                title: "", text: "Do you really want to active this member??",
                showCancelButton: true,
                confirmButtonColor: '#8CC73F',
                confirmButtonText: 'Yes',
                cancelButtonText: "No", closeOnConfirm: true,
                closeOnCancel: true
            },
            function (isConfirm) {
                if (isConfirm) {
         var xmlhttp2 = false;
        try {
            xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp2 = false;
            }
        }
        if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
            xmlhttp2 = new XMLHttpRequest();
        }
        
       
           
        var url='<?php echo base_url(); ?>' +'active-block-requesting-group-member';
            
           
            var formdata = new FormData();
            formdata.append("group_member_id", group_member_id);
            formdata.append("group_id", group_id);
          
        xmlhttp2.addEventListener("load", function () {
         
           var url=document.getElementById('url_id').value;
            window.location='<?php echo base_url(); ?>'+'pending-member-information/'+url;
           
            
          
            }, false);
            xmlhttp2.addEventListener("error", function () {
                alert("not upload");
            }, false);
            xmlhttp2.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp2.open("POST", url);
            xmlhttp2.send(formdata); 
        }
      });
 }
  
</script>