<?php
$this->load->view("main/admin/header");
?>
<div class="col-lg-12">
<section class="panel">
        <header class="panel-heading">لیست گروه های تلگرام</header>
                            <div class="panel-body">
								<a href="<?php echo base_url(); ?>admin/create_bot"><button class="btn btn-info" style="margin-bottom:10px;">ایجاد گروه تلگرام</button></a>
								<table class="table table-striped border-top dataTable" id="sample_1" aria-describedby="sample_1_info">
                                <thead>
                                    <tr role="row"><th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 100px;">ردیف</th><th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Points: activate to sort column ascending" style="width: 146px;">نام گروه ربات</th>
									
									<th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label=": activate to sort column ascending" style="width: 225px;"></th>
									
									</tr>
                                </thead>
                                
                            <tbody role="alert" aria-live="polite" aria-relevant="all">
										<?php $count=1; foreach($botgroup as $value){ ?>
										<tr class="gradeX odd" data_id="<?php echo $value->id; ?>">
                                        <td class="radife"><?php echo $count; ?></td>
                                        <td class="hidden-phone "><?php echo $value->name; ?></td>
										
                                        
										<td class="icons">
											<a href="./edit_bot?id=<?php echo $value->id; ?>"><button class="btn btn-primary btn-xs"><i class="icon-pencil"></i></button></a>
											<a href="./create_instanse?id=<?php echo $value->id; ?>"><button class="btn btn-warning btn-xs"><i class="icon-copy"></i></button></a>
											<button class="btn btn-danger btn-xs" href="#myModal-1" data-toggle="modal"><i class="icon-trash "></i></button>
										</td>
									
                                    </tr>
										<?php $count++; } ?>
							</tbody></table>
							</div>
</section>
</div>
<?php
$this->load->view("main/admin/footer");
?>
<script>
	$(".btn-danger").click(function(){
			if(confirm("آیا از پاک کردن این گروه ربات اطمینان داری؟")){
		$id = $(this).parent().parent().attr("data_id");
		$value = $(this).parent().parent()
		$.post("<?php echo base_url(); ?>/admin/delete_gbot_control",{id:$id},function(e){
			if (e == "done") {
				$value.remove();
			}
			});
		}
		});
</script>