<? require_once($_SERVER['DOCUMENT_ROOT'].'/admin/block/head.php'); ?>

<div class="row">
<div class="col-md-9">
<div class="panel panel-primary">

<table class="table table-bordered">
<tr>
<th style="width: 30px"><center>№</center></th>
<th>Название продукции</th>
<th style="width: 70px"><center>Операции</center></th>
</tr>

<?
$sql = mysql_query("SELECT `id`,`name` FROM `nano_osnova` WHERE `asoc`='1'") or die(mysql_error());
if(mysql_num_rows($sql) > '0'){
while($row = mysql_fetch_assoc($sql)){
$id = $row["id"];
$name = $row["name"];
?>
<tr>
<td><center><b><?=$id;?></b></center></td>
<td><?=$name;?></td>
<td><center>
<a href="/admin/ed_osnova_<?=$id;?>" class='fa fa-pencil-square-o' style="padding-right: 5px; text-decoration: none; cursor: pointer;" data-toggle="tooltip" title='Редактировать'></a>
<a class='fa fa-trash-o' style="padding-right: 5px; text-decoration: none;" data-toggle="tooltip" title='Удалить' href='javascript:void(0);' onclick='del_<?=$id;?>();'></a>
</center></td>
</tr>
<script>
function del_<?=$id;?>() {
{
$.ajax({
type: "POST", 
url: "/admin/ajax/add_tovar.php", 
data: { 'func' : 'del', 'id' : <?=$id;?>},
beforeSend: function(){ progress = true;},
success: function(data) {
if(data == 1) { QBinfo('Поздравляем:','Товар <?=$name;?> удален.',4000,'bottom-right');
setTimeout('location.replace("/admin/osnova")', 2000);
}
progress = false;
}
});
}
}
</script>
<?}?>
</table>
<?}else{?>
<tr>
<td colspan="3">
<center>Категорий нет</center>
</td>
</tr>
</table>
<?}?>
</div>
</div>

<div class="col-md-3">
<div class="results">
<div class="panel panel-primary">
<div class="panel-heading"><a class="btn btn-success btn-block" href='/admin/add_osnova'>Добавить</a></div>

</div>

</div>
</div>

</div>

<? require_once($_SERVER['DOCUMENT_ROOT'].'/admin/block/foot.php'); ?>