<?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
$result1 = $mysqli->query("SELECT * FROM requests");
$rows = mysqli_num_rows($result1);
?>
<a href="list-requests.php"><?php echo $adminrequests ?></a>  (<?php echo $rows ?>)
</div>
<div class="framein">

<?php
include ('pagination.php'); 

$result = $mysqli->query("SELECT * FROM requests ORDER BY orderid desc, id desc LIMIT $start,$nritems");
while($row = $result->fetch_array()) {
$count++;
$id=$row['id'];
$orderid=$row['orderid'];
$cookie_id=$row['cookie_id'];
$member_id=$row['member_id'];
$itemid=$row['item_id'];
$name=$row['name'];
$email=$row['email'];
$address=$row['address'];
$country=$row['country'];
$destination=$row['country'];
$tel=$row['tel'];
$item=$row['items'];
$startdate=$row['startdate'];
$enddate=$row['enddate'];
$adults=$row['adults'];
$children=$row['children'];
$comments=$row['comments'];
$amount=$row['amount'];
$currency=$row['currency'];
$period=$row['period'];
$paytype=$row['paytype'];
$url=$row['url'];
$date=$row['date'];

$totalamount = $totalamount+$amount;

if( $member_id!=0 ){
$result2 = $mysqli->query("SELECT * FROM members WHERE id='$member_id'");
$row = $result2->fetch_array();
$email=$row['email'];
$name=$row['name'];
$profession=$row['profession'];
$company=$row['company'];
$address=$row['address'];
$postcode=$row['postcode'];
$region=$row['region'];
$country=$row['country'];
$city=$row['city'];
$tel=$row['tel'];
$fax=$row['fax'];
$taxnr=$row['taxnr'];
$taxoffice=$row['taxoffice'];

$address="$address $region $postcode $city";
}
$address = trim($address);
?>
      <div class="framerow">
        <table>
          <tr valign="top"> 
            <td> 
             <span class="titles color3"><?php echo $name ?></span> &nbsp; &nbsp;
             <strong><?php if ($orderid!='0') { echo $orderid; } ?></strong>
              <hr> 
              <table>
                <tr>
                  <td width="30"><span class="icon fa-envelope"></span></td>
                  <td><a href="mailto:<?php echo $email ?>?subject=<?php echo $firma?> Newsletter" class="links" title="email"><?php echo $email ?></a></td>
                </tr>
                <?php if ($address) { ?>
                <tr> 
                  <td width="30"><span class="icon fa-home"></span></td>
                  <td> 
                    <?php echo $address ?> 
                  </td>
                </tr>
                <?php } ?>
                <?php if ($country) { ?>
                <tr class="color2">
                  <td><span class="icon fa-map-marker"></span></td>
                  <td><strong><?php echo $country ?></strong> <?php if ($destination!=$country) { echo "&raquo; ".$destination; } ?> </td>
                </tr>
                <?php } ?>
                <?php if ($tel OR $fax) { ?>
                <tr> 
                  <td><span class="icon fa-phone"></span></td>
                  <td> 
             <?php echo $tel ?> 
             <?php if ($fax) { ?>
            &nbsp; &nbsp; <span class="icon fa-fax"></span> <?php echo $fax ?>
             <?php } ?>
                  </td>
                </tr>
              <?php } ?>  
                <?php if ($taxnr OR $taxoffice) { ?>
                <tr>
                  <td><span class="icon fa-folder"></span></td>
                  <td><?php echo $taxnr ?> <?php echo $taxoffice ?></td>
                </tr>
                <?php } ?>
                <tr class="color1">
                  <td><span class="icon fa-tag"></span></td>
                  <td>
<?php if ($itemid>0) { ?>
<?php
$resulti = $mysqli->query("SELECT name FROM items WHERE insert_id=$itemid AND lang_id=$lang");
$row = $resulti->fetch_array();
$item=$row['name']; 
?>              
<a href="edit-item.php?id=<?php echo $itemid?>" class="color1"><?php echo $item ?></a>
<?php } else {?>
<?php echo $item ?>
<?php } ?> 
                  </td>
                </tr>
                <tr> 
                  <?php if ($type==3 && ($startdate OR $enddate OR $adults)) { ?>
                  <td><span class="icon fa-calendar"></span></td>
                  <td> 
                    <?php echo $startdate ?> &raquo; <?php echo $enddate ?>
                  &nbsp; &nbsp; <span class="icon fa-user"></span> <?php echo $adults ?> <span class="icon fa-child"></span> <?php echo $children ?></td>
                  <?php } ?> 
                </tr>
                <?php if ($comments) { ?>
                <tr>
                  <td><span class="icon fa-comment"></span></td>
                  <td><?php echo $comments ?></td>
                </tr>
                <?php } ?>
                <?php if ($url) { ?>
                <tr>
                  <td><span class="icon fa-link"></span></td>
                  <td><a href="http://<?php echo $url ?>" target="_blank" class="links"><?php echo $url ?></a></td>
                </tr>
               <?php } ?>  
             <?php if ($amount!='0.00') { ?>
                <tr class="color1">
                  <td><span class="icon fa-eur"></span></td>
                  <td><strong><?php echo $amount ?></strong>
                  &nbsp; &nbsp;
                  <?php if ($paytype=='card') { ?>
                 <span class="icon fa-credit-card color3"></span> 
                 <?php if ($period>0) { echo $period; } ?>
                 <?php } ?> 
                  </td>
                </tr>
                <?php } ?>
              </table>
            </td>
            <td width="100">
              <?php $s_year = substr("$date", 0, 4);   ?>
              <?php $s_month = substr("$date", 5, 2);   ?>
              <?php $s_day = substr("$date", 8, 2);   ?>
              <strong><?php  echo $s_day ?>.<?php  echo $s_month ?>.<?php  echo $s_year ?></strong>
            </td>
          </tr>
        </table>
      </div>
      <hr>
	  <?php } ?>
<?php if ($totalamount!='0.00') { ?>
 &nbsp; <span class="icon fa-eur price"></span> &nbsp; &nbsp; <span class="price"><?php echo $totalamount ?></span> 
<?php } ?>  
<hr>

<?php if ($rowsrequests>0) { ?>      
<div> 
<a href="mailto:<?php echo $sitemail ?>?Bcc=<?php 
$result3 = $mysqli->query("SELECT email FROM requests WHERE email!='' ORDER BY id desc LIMIT $start,$nritems");
while($row = $result3->fetch_array()) {
$email=$row['email'];?><?php echo $email ?>,<?php }?>&subject=<?php echo $firma ?>" class="icstyle1 color1" title="email"><span class="icon fa-envelope"></span></a>
</div>
<?php } ?>
      
<div class="divpaginate">
<?php include 'paginate.php';?>
</div>

</div>
</div>
</div>

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

</body>
</html>