<?php $this->load->view("main/drs/header"); ?>
<div class="col-lg-12">
<section class="panel">
        <header class="panel-heading">لیست مقالات</header>
                            <div class="panel-body">
								<div id="sample_1_wrapper" class="dataTables_wrapper form-inline" role="grid">
								<a href="<?php echo base_url() ?>panel/Articles" class="btn btn-warning" style="margin-bottom:10px;">ایجاد مقاله</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="Email: activate to sort column ascending" style="width: 290px;">تاریخ</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($result as $value){ ?>
									

										<tr class="gradeX <?php echo $count %2 == 0 ? "even" : "odd" ?>" data_id="<?php echo $value->id; ?>">
                                        <td class="radife"><?php echo $count; ?></td>
                                        <td class="hidden-phone "><?php echo $value->date; ?></td>
										<td class="hidden-phone "><?php echo $value->title; ?></td>
                                        
										<td class="icons">
											<a href="<?php echo base_url(); ?>panel/edit_articles?id=<?php echo $value->id ?>"><button class="btn btn-primary btn-xs"><i class="icon-pencil"></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/drs/footer"); ?>
<script>
	$(".btn-danger").click(function(){
		$id = $(this).parent().parent().attr("data_id");
		alert($id);
		$value = $(this).parent().parent();
		$.post("<?php echo base_url() ?>panel/delete_article_control",{id:$id},function(e){
			if (e == "done") {
				$value.remove();
			}
			});
		});
</script>