<?php include 'sets.php';?>
<?php
$superuser="0";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Webadmin <?php echo $domain ?></title>
<?php include 'codes.php';?>
</head>
<body>

<?php include 'navbar.php';?>
    
<div class="container">
<div class="frame">
<div class="frametitles flist">
<?php
$result = $mysqli->query("SELECT * FROM transport");
$nrrows = mysqli_num_rows($result);
?>
<a href="list-transport.php"><?php echo $admintransport ?></a> (<?php echo $nrrows ?>)
<div class="floatright"><a href="add-transport.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a></div>
</div>
<div class="framein">

<?php
$result = $mysqli->query("SELECT * FROM transport ORDER BY priority");
while($row = $result->fetch_array()) {
$id=$row['id'];
$name=$row['name'];
$startprice=$row['startprice'];
$startweightprice=$row['startweightprice'];
$kgprice=$row['kgprice'];
$publish=$row['publish'];
$priority=$row['priority'];
?>
<div class="framerow<?php if ($publish=='no') { echo " notpublished"; }?>">
  <table>
    <tr> 
      <td class="divpriority"><?php echo $priority ?></td>
      <td>
        <a href="edit-transport.php?id=<?php echo $id?>" class="titles"><?php echo $name ?></a>
        </td>
      <td class="divdetails2"> Start < <?php echo $siteweight ?> Kg <strong><?php echo $startweightprice ?> &#8364;</strong></td>
      <td class="divdetails2"> Start > <?php echo $siteweight ?> Kg <strong><?php echo $startprice ?> &#8364;</strong></td>
      <td class="divdetails2">
     +  <strong><?php echo $kgprice ?> &#8364;</strong> / Kg
     </td>
      <td width="50" align="center">
        <?php if ($publish=='no') { ?>
       <span class="icon icstyle1 fa-eye-slash" title="<?php echo $adminpublish ?> &raquo; <?php echo $adminno ?>"></span>  
       <?php } ?>
          </td>
      <td class="divdetails2">
        <a href="edit-transport.php?id=<?php echo $id?>" class="linkoption" title="<?php echo $adminedit ?>"><span class="icon fa-edit"></span> <?php echo $adminedit ?></a>
        </td>
      <td class="divdetails2"> 
<?php
if  (isset($_POST['deleterow'])) {
$mysqli->query("DELETE FROM transport WHERE id='{$_REQUEST['id']}'");
$mysqli->query("ALTER TABLE transport AUTO_INCREMENT = 1");
?>
<meta http-equiv="refresh" content="0;URL=list-transport.php">   
<?php } ?>       
          <form name="formdelete" method="post">
          <input type="hidden" name="id" value="<?php echo $id ?>">
          <button type="submit" name="deleterow" class="linkoption linkdelete" title="<?php echo $admindelete ?>"><span class="icon fa-trash-o"></span> <?php echo $admindelete ?></button>
          </form>
        </td>
      </tr>
  </table>
</div>
<?php } ?>
</div>
</div>
</div>

<?php include 'menudown.php';?>

</body>
</html>