<?php
include 'session.php';

//Array Hari
$array_hari = array(1=>"Senin","Selasa","Rabu","Kamis","Jumat", "Sabtu","Minggu");
$hari = $array_hari[date("N")];
//Format Tanggal
$tanggal = date ("j");
//Array Bulan
$array_bulan = array(1=>"Januari","Februari","Maret", "April", "Mei", "Juni","Juli","Agustus","September","Oktober", "November","Desember");
$bulan = $array_bulan[date("n")];
//Format Tahun
$tahun = date("Y");
//Menampilkan hari dan tanggal


$count = mysql_query("SELECT id_perusahaan FROM perusahaan");
$a=mysql_num_rows($count);

$count1 = mysql_query("SELECT id_paket FROM paket");
$paket=mysql_num_rows($count1);

$count2 = mysql_query("SELECT id_berita FROM berita");
$berita=mysql_num_rows($count2);

$sql = mysql_query("SELECT * FROM pemenang");
$keterangan=mysql_fetch_array($sql);

?>

<div class="col-md-9">
	<div class="panel panel-default">
		<div class="panel-body">

<div class="page-header">
			<h2>Home</h2>
			<ol class="breadcrumb">
				<li class="active"><i class="fa fa-home"> Home</i></li>
                
                 <li class="active "><?php  echo" $hari, $tanggal $bulan $tahun";?></li>
            </ol>
	</div>


 <div class="col-md-8 col-md-offset-2">
<div class="row">
                    <div class="col-md-offset-0 col-md-12">
                    <div class="alert alert-info  alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert">x</button>
                        <center>Selamat datang <?php echo$row['nama'];?></center>
                    
                    </div></div></div></div>

<div class="col-md-4">
                        <div class="panel panel-green">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-users fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div style="font-size:20pt"><?php echo $a;?></div>
                                        <div>Perusahaan</div>
                                    </div>
                                </div>
                            </div>
                            <a href="dashboard.php?cat=web&page=perusahaan">
                                <div class="panel-footer">
                                    <span class="pull-left"> Lihat Selengkapnya</span>
                                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                                    <div class="clearfix"></div>
                                </div>
                            </a>
                        </div>
 </div>

 <div class="col-md-4">
                        <div class="panel panel-red">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-tasks fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div style="font-size:20pt"><?php echo $paket;?></div>
                                        <div>Paket Tender</div>
                                    </div>
                                </div>
                            </div>
                            <a href="dashboard.php?cat=web&page=paket">
                                <div class="panel-footer">
                                    <span class="pull-left"> Lihat Selengkapnya</span>
                                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                                    <div class="clearfix"></div>
                                </div>
                            </a>
                        </div>
 </div>

 <div class="col-md-4">
                        <div class="panel panel-yellow">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-newspaper-o fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div style="font-size:20pt"><?php echo $berita;?></div>
                                        <div>Berita</div>
                                    </div>
                                </div>
                            </div>
                            <a href="dashboard.php?cat=web&page=berita">
                                <div class="panel-footer">
                                    <span class="pull-left"> Lihat Selengkapnya</span>
                                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                                    <div class="clearfix"></div>
                                </div>
                            </a>
                        </div>
 </div>


<div class="col-lg-6">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Status Paket Tender</h3>
                            </div>
                            <div class="panel-body">
                                <div class="list-group">
                                    <?php
                                    $sqla=mysql_query("Select * from paket");
                                    if(mysql_num_rows($sqla)== 0){
                                         echo"<center><span class='label label-danger'>Paket Tidak Tersedia</span></center>";
                                  
                                    }else{

                                        $sqle=mysql_query("Select * from paket");
                                    while($aaa=mysql_fetch_array($sqle))
                                    {
                                    $rwq=mysql_query("Select * from pemenang where id_paket='".$aaa['id_paket']."'");
                                     $sq=mysql_fetch_array($rwq);
                                 
                                    ?>
                                    <a href="#" class="list-group-item">
                                        <?php
                                        if($sq['keterangan']==1){
                                            echo" <span class='badge1'>Expired</span>";
                                        }else{

                                            echo" <span class='badge2'>Ongoing</span>";
                                        }

                                        ?>
                                        <?php echo $aaa['nama_paket'];?>
                                    </a>
                                    <?php
                                    
                                     }
                                 }
                                    ?>

                                </div>
                                <div class="text-right ">
                                    <a href="dashboard.php?cat=web&page=paket" style="color:#fff;font-size:9pt" class="label label-info">View All Activity <i class="fa fa-arrow-circle-right"></i></a>
                                </div>
                            </div>
                        </div>
                    </div>

<div class="col-lg-6">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title"><i class="fa fa-check fa-fw"></i> Join Tender</h3>
                            </div>
                            <div class="panel-body">
                                <div class="list-group">
                                <?php
                                    $sqla=mysql_query("Select * from paket");
                                    $aar=mysql_fetch_array($sqla);
                                    if(empty($aar['nama_paket'])){
                                        echo"<center><span class='label label-danger'> Tender Tidak Tersedia</span></center>";
                                  
                                    }else{
                                    $sql=mysql_query("Select * from paket");
                                    while($aa=mysql_fetch_array($sql))
                                    {
                                    $hitung = mysql_query("SELECT id_perusahaan FROM peserta WHERE id_paket = '".$aa['id_paket']."'");
                                    $as=mysql_num_rows($hitung);
                                    ?>
                                    <a href="#" class="list-group-item">
                                        <span class="badge"><?php echo $as;?></span>
                                        <?php echo $aa['nama_paket'];?>
                                    </a>
                                    <?php
                                    }
                                }
                                    ?>


                                </div>
                                <div class="text-right">
                                    <a href="dashboard.php?cat=web&page=paket" style="color:#fff;font-size:9pt" class="label label-info">View All Activity <i class="fa fa-arrow-circle-right"></i></a>
                                </div>
                            </div>
                        </div>
                    </div>






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