<!-- 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">All Teams</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-1" style="width:100%;">

										<!-- <thead>

							                <tr>

							                  <th>SR.No.</th>

							                  <th>Client Name</th>

							                  <th>Description</th>

							                  <th>Action</th>

							                </tr>

							            </thead> -->

							            <tbody>

							            	<tr>

				            					<td class="tbody">

									                <?php if(!empty($post)){ foreach ($post as $key => $value): ?>

									                	<div id="<?php echo "team_".$value['id']; ?>" class="panel panel-default orderby mb-10" data-order="<?php echo $value['id']; ?>">

							                				<div class="panel-body pa-0">

									                			<table class="table mb-0">

													                <tr>

													                  <td style="width:5%;"><?php echo $key+1; ?></td>
													                  <td style="width:10%;">

													                  	<?php if($value['image']!=''){ ?>

													                  		<img src="<?php echo base_url($value['image']); ?>" alt="image" style="width:100px;">

													                  	<?php } ?>

													                  </td>

													                  <td>

													                  	<p><strong><?php echo $value['name']; ?></strong></p>

													                  	<p><?php echo $value['position']; ?></p>

													                  </td>

													                  <td style="width:10%;">Featured <input type="radio" name="isFeatured" class="isFeatured" value="1" data-id="<?php echo $value['id']; ?>" <?php echo ($value['isFeatured']==1)?'checked':""; ?> /></td> 

													                  <td style="width:8%;">

													                    <a href="<?php echo base_url(A."/edit-team/".$value['id']); ?>" class="text-inverse pr-10" data-value=""><i class="fa fa-pencil-square fa-lg"></i></a>

													                    <a href="javascript:void(0)" class="text-inverse hpdelete" data-table="team" data-value="<?php echo "teamid_".$value['id']; ?>" data-image='' data-id="<?php echo $value['id']; ?>"><i class="fa fa-trash-o fa-lg"></i></a>

													                  </td>

									                				</tr>

									                			</table>

									                		</div>

									                	</div>

									                <?php endforeach; } ?>

									            </td>

									        </tr>

							            </tbody>

									</table>

								</div>

							</div>



						</div>



						<div class="panel-footer clearfix">



                            <div class="row">



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



                                    <div class="text-center"><?php echo (isset($links))?$links:""; ?></div>



                                </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; ?>";



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



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



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



	    var pimage = $(this).attr('data-image');



	    var ok = confirm("Are you sure you want to delete? Deleted records are not retrievable.");



	    if (ok) {



	        $.ajax({



	            url: site_url+urlLink+'/ajaxDelete',



	            type:'POST',



	            data:'id='+id+'&pimage='+pimage+'&table='+table,



	            success: function(data){



	                location.reload();



	            },



	        });



	    }



	});

	$('.isFeatured').change(function(){



	    var td = this.checked ? '1' : '0';



	    var pid = $(this).attr('data-id');



	    



	    $.ajax({



	        url: site_url+urlLink+"/setFeaturedTeam",



	        type: "POST",



	        data: "id="+pid+"&isFeatured="+td,



	        success: function(data){  



	        	alert('Status Update');

	        	// location.reload();



	        }



	    });



	});



</script>

<script>

	$(function() {

      $('.tbody').sortable({

        delay: 150,

        stop: function() {

          var div = [];

          $('.orderby').each(function() {

            var id = $(this).attr('data-order');

            if(id!='undefined'){

              div.push(id);

            }

          });

            var site_url = '<?php echo base_url(); ?>';

            $.ajax({

              url: site_url+urlLink+"/updateListItemOrder",

              type: "POST",

              dataType:"json",

              data: "div="+div+"&table=team",

              success: function(result){

                

              }

            });

        }

      });

  	});

</script>