<?php require('header.php'); ?>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script
  src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
  integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
  crossorigin="anonymous"></script>
<!-- <div>
    <ul class="breadcrumb">
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">Dashboard</a>
        </li>
    </ul>
</div> -->
<script type="text/javascript" language="javascript">

    function close_window(){
        $('#view_info').hide();
    }

    function get_cust_info(id,pinakida,mexri,type){
        $.ajax({
        type: "POST",
        url: 'xl_tbl.php',
        data: {KodPel: id, Pinakida: pinakida, Im_mexri: mexri, type: type},
        success: function(data){
            if(type!='delete'){
                $('#view_content').html(data);
                $('#view_info').show();
            } else {
                alert(data);
                location.reload();
            }
            
            // $('#view_info').draggable();
            // $('#view_info').resizable({
            //     animate:true
            // });
            // $('#view_info').css({'top': -50, 'left': '5%'});
            
        },
        dataType: 'html'
        });
    }

</script>
<div class=" row">
    <div class="col-md-3 col-sm-3 col-xs-6">
        <a data-toggle="tooltip" title="6 new members." class="well top-block" href="?view=expired">
            <i class="glyphicon glyphicon-user blue"></i>

            <div>Έχουν Λήξει</div>
            <div></div>
            <span class="notification"></span>
        </a>
    </div>

    <div class="col-md-3 col-sm-3 col-xs-6">
        <a data-toggle="tooltip" title="4 new pro members." class="well top-block" href="#">
            <i class="glyphicon glyphicon-star green"></i>

            <div>Expired</div>
            <div>228</div>
            <span class="notification green">4</span>
        </a>
    </div>

    <div class="col-md-3 col-sm-3 col-xs-6">
        <a data-toggle="tooltip" title="$34 new sales." class="well top-block" href="#">
            <i class="glyphicon glyphicon-shopping-cart yellow"></i>

            <div>Sales</div>
            <div>$13320</div>
            <span class="notification yellow">$34</span>
        </a>
    </div>

    <div class="col-md-3 col-sm-3 col-xs-6">
        <a data-toggle="tooltip" title="12 new messages." class="well top-block" href="#">
            <i class="glyphicon glyphicon-envelope red"></i>

            <div>Messages</div>
            <div>25</div>
            <span class="notification red">12</span>
        </a>
    </div>
</div>
<div class="row">
<div class="box col-md-12">
<div class="box-inner">
<div class="box-header well" data-original-title="">
    <h2><i class="glyphicon glyphicon-user"></i> Γενικός Πίνακας</h2>

   
</div>
<div class="box-content">

<table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
<thead>
<tr>
    <th>id</th>
    <th>Επώνυμία Πελάτη</th>
    <th>Τηλέφωνο</th>
    <th>Αριθμός Κ.</th>
    <th>Εταιρία</th>
    <th>Ημερομηνία Έκδοσης</th>
    <th>Ημερομηνία Λήξης</th>
    <th>Συνεργάτης</th>
    <th>Ενέργειες</th>
</tr>


</thead>

                          <tbody>
                          <?php 
                          
                          
$dbHost = 'localhost';
$dbUser = 'safehunter_admindb';
$dbPass = 'dcm-1269';
$dbName = 'safehunter_asfaleies';
$dbC = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName) or die('Error Connecting to MySQL DataBase');   
                          
                    
                    mysqli_query($dbC,"SET NAMES 'utf8'");
                    mysqli_query($dbC,"SET CHARACTER SET 'utf8'");
                    $query = "Select * from Asf_pelates";
                    $result = mysqli_query($dbC,$query) or die(mysqli_error());
                    $y=0;
                    while($row = mysqli_fetch_array($result)){
                      if(strtotime('-1 week')<strtotime($row['Im_mexri'])){
                            echo "<tr>";
                            echo "<td>".$row['KodPel']."</td>";
                            echo "<td>" . $row['Eponumia_pel'] ." </td>";
                            echo "<td>" . $row['Til_Epikoin'] . "</td>";
                            echo "<td>" . $row['Pinakida'] . "</td>";
                            echo "<td>". $row['Asfalizomenos'] ."</td>";
                            echo "<td>". $row['Im_ekdosis'] ."</td>";
                            echo "<td>". $row['Im_mexri'] ."</td>";
                            // echo "<td>". $row['Im_mexri'] ."</td>";
                            echo "<td>". $row['Promitheies_sunergati'] ."</td>";
                            echo "<td class=\"center\">
                            <a class=\"btn btn-success\" onclick=\"get_cust_info('".$row['KodPel']."','".$row['Pinakida']."','".$row['Im_mexri']."','view')\">
                            <i class=\"glyphicon glyphicon-zoom-in icon-white\"></i>View</a>
                            <a class=\"btn btn-info\" href=\"#\" onclick=\"get_cust_info('".$row['KodPel']."','".$row['Pinakida']."','".$row['Im_mexri']."','edit')\">
                            <i class=\"glyphicon glyphicon-edit icon-white\"></i>Edit</a>
                            <a class=\"btn btn-danger\" href=\"#\"><i class=\"glyphicon glyphicon-trash icon-white\"></i>Delete</a></td>";
                            $y++;
                        } 
                    }
                    
                          ?>

    </tr>                     </tbody>
                      </table>





</div>
</div>
</div>
<!--/span-->
    <!--/span-->
</div><!--/row-->
<div class="row">
    <div class="col-md-3 col-sm-3 col-xs-6 center">
    <input class="btn btn-default" type="button" value="Import Interlife" />
    <a href="xl_upload.php" class="btn btn-default">Upload File</a>
    <input class="btn btn-default" type="button" value="Import 2" />
    <input class="btn btn-default" type="button" value="Import 3" />
  </div>
</div>

<div id="view_info" class="dataTables_wrapper">
<div id="view_close" onclick="close_window();">X</div>
<div id="view_content"></div> 

</div>
<?php require('footer.php'); ?>
