<?php
include "asset/fungsi/fungsi_indotgl.php";
include "asset/fungsi/fungsi_rupiah.php";
?>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-body">
	

	<div class="page-header">
			<h2>Paket Tender</h2>
			<ol class="breadcrumb">

				<li><a href="dashboard.php"><i class="fa fa-home"> Home</i></a></li>
				<li class="active"><i class="fa fa-tasks"> Paket Tender </i></li>
            </ol>
	</div>


<?php

			

?>

<table id="tabel" class="table table-bordered display" cellspacing="0" width="100%">
		<thead>
		<tr class="success">
			<th width="2%">No</th>
        	<th>Nama Paket</th>
            <th>Nama Proyek</th>
            <th width="15%">HPS</th>
            <th width="15%">Keterangan</th>
            <th width="10%">File Pendukung</th>
            <th width="15%">Status</th>
            <th width="10%"><center>Join</center></th>
         
		</tr>
		</thead>

		<tbody>
		<?php
  		$nomor=0;
      $rw=mysql_query("Select * from paket order by id_paket DESC");
      while($s=mysql_fetch_array($rw))
      {$nomor++;
        $rwq=mysql_query("Select * from pemenang where id_paket='".$s['id_paket']."'");
      $sq=mysql_fetch_array($rwq);
        $hps=format_rupiah($s['hps']);
      ?>
      <tr>
        <td align="center"><?php echo $nomor; ?></td>
        <td><?php echo $s['nama_paket']; ?></td>
        <td><?php echo $s['nama_proyek']; ?></td>
        <td><?php echo"Rp. ";echo $hps; ?></td>
        <td><?php echo $s['kecamatan']; ?></td>
        <td>
          <center>
           <?php
        if ($s['file'] != NULL) 
        {
          ?>
          <a class="btn btn-default tooltipsku" target="_blank"  href="asset/img/file/<?php echo $s['file']; ?>" data-placement="top" title="Lihat"><i class="fa fa-eye"></i></a>
        
          <?php
        }else{
          echo"<span class='label label-danger'>Tidak ada file</span>";
        }
        ?>
      </center>
        </td>

        <?php
        if($sq['keterangan']==0){
          echo"<td><center><span class='label label-info'>Ongoing</span></center></td>";
          ?>
          <td align="center">
      
        <button href="#" class="btn btn-success tooltipsku" data-placement="top" title="Join Paket" data-toggle="modal" data-target="#modal_join<?php echo $s['id_paket'];?>"><i class="fa fa-check" >   </i></button>
        </td>
          <?php
        }else{

          echo"<td><center><span class='label label-danger'>Expired</span></center></td>";
          ?>
          <td align="center">
      
        <button href="#" class="btn btn-success tooltipsku" data-placement="top" title="Join Paket" data-toggle="modal" data-target="#modal_join<?php echo $s['id_paket'];?>" disabled><i class="fa fa-check" >   </i></button>
        </td>
          <?php
        }
        ?>
        
    		
		</tr>
		<?php
   		 }
      
 		?>
		</tbody>
</table>

</div>
</div>
</div>
<?php


$rw=mysql_query("Select * from paket");
while($s=mysql_fetch_array($rw)){
?>
<div id="modal_join<?php echo $s['id_paket'];?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Konfirmasi</h4>
            </div>
            <div class="modal-body">

<form class="form-horizontal" role="form" method="post" action="dashboard.php?cat=perusahaan&page=join_paket" enctype="multipart/form-data">
<div class="form-group">
    <div class="col-md-offset-1 col-md-10">
        <div class="alert alert-danger  alert-dismissable">
        <button type="button" class="close" data-dismiss="alert"></button>
        <center>Apakah Anda Yakin akan Mengikuti Tender <strong style="color:red"> <?php echo $s['nama_paket'];?></strong>?</center>
        </div></div>
   </div>


      <input type="hidden" class="form-control" name="id_paket" value="<?php echo $s['id_paket'];  ?>" required > 
      
  
            </div>
 
 <div class="modal-footer">
        <button type="submit" name="simpan" class="btn btn-primary">Join</button>
      </div>
            </form>
        </div>
    </div>
</div>
<?php
}
?>
