<?php 
	//open form
	echo form_open(base_url('biayaformulir/tambah'),' class="form-horizontal"'); 
?>

<p class        = "text-left">
	<button type   = "button" class="btn btn-info" data-toggle="modal" data-target="#modal-default">
		  <i class    = "fa fa-plus"></i> Transaksi
	</button>
	<!-- <a class       = "btn btn-primary" href="<?php echo base_url('biayaformulir/export') ?>" onclick="return confirm('Yakin ingin mengexport rekap berkas ke excel ?')"><i class="fa fa-file-excel"></i> Export Excel</a> -->
	<a href        = "<?php echo base_url('dashboard') ?>" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times">
	</i> Kembali</a>	
</p>

<?php
//panggil form tambah
include('tambah.php');
//closing form
echo form_close();
?>

<table class    = "table table-bordered table-striped table-sm" id="example6">
	<thead>
		<tr>
			<th >NO.</th>
			<th >TGL. TRANSAKSI</th>
			<th >NO. TRANSAKSI</th>
			<th >NO. PENDAFTARAN</th>
			<th >GELOMBANG</th>
			<th >NAMA LENGKAP</th>
			<th >JENIS KELAMIN</th>
			<th >SEKOLAH ASAL <span class="hide-on-export">/KOMP. DIMINATI</span></th>		
			<th >KOMP. DIMINATI</th>		
			<th>ACTION</th>		
		</tr>
	</thead>
	<tbody>
		<?php foreach ($formulir as $key => $formulir) { ?>
					
		<tr>
			<td><?php echo $key+1; ?></td>
			<td><b><?php
		// Contoh tanggal dalam format Y-m-d (misal: '2024-04-12')
		$tanggal = $formulir->tgl_trans;

		// Format tanggal ke dalam format "dd/mm/yyyy"
		$tanggal_formatted = date('d/m/Y', strtotime($tanggal));

		echo $tanggal_formatted; // Output: misal 12/04/2024
		?>
		</b></td>
			<td><b><?php echo $formulir->no_trans ?></b></td>

			<td><b><?php echo $formulir->no_pendaftaran ?></b>				
				<br><small class="hide-on-export"><?php echo $formulir->gelombang ?></small>
			</td>		
			<td><?php echo $formulir->gelombang ?></td>
			<td><b><?php echo $formulir->nama_lengkap ?></b>
				<br><small class="hide-on-export"><?php echo $formulir->jkelamin ?></small>
			</td>
			<td><?php echo $formulir->jkelamin ?></td>
			<td><b><?php echo $formulir->sekolah_asal ?></b>				
				<br><small class="hide-on-export"><?php echo $formulir->kompetensi ?></small>
			</td>	
			<td><?php echo $formulir->kompetensi ?></td>
			<td>
				<div class  = "btn-group">
					

					<a href    = "<?php echo base_url('biayaformulir/cetakberkas/'.$formulir->no_pendaftaran) ?>" target="_blank" class="btn btn-warning btn-sm">
						<i class  = "fa fa-print"></i>
					</a>
					
					<?php if($this->session->userdata('level')=="Administrator") { ?>
					<a href    = "<?php echo base_url('biayaformulir/delete/'.$formulir->no_pendaftaran) ?>" class="btn btn-danger btn-sm" onclick="return confirm('Yakin ingin menghapus data pembelian formulir <?php echo $formulir->nama_lengkap ?> [ <?php echo $formulir->no_pendaftaran ?> ] ..?')">
						<i class  = "fa fa-trash"></i>
					</a>
					<?php } ?>
				</div>
			</td>
		</tr>

	<?php } ?>
	</tbody>
</table>