<script src="<?php echo base_url();?>assets/js/jquery-2.2.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
	(function($, undefined) {

		"use strict";

		// When ready.
		$(function() {
			
			var $form = $( "#form" );
			var $input = $form.find( "input" );

			$input.on( "keyup", function( event ) {
				
				
				// When user select text in the document, also abort.
				var selection = window.getSelection().toString();
				if ( selection !== '' ) {
					return;
				}
				
				// When the arrow keys are pressed, abort.
				if ( $.inArray( event.keyCode, [38,40,37,39] ) !== -1 ) {
					return;
				}
				
				
				var $this = $( this );
				
				// Get the value.
				var input = $this.val();
				
				var input = input.replace(/[\D\s\._\-]+/g, "");
						input = input ? parseInt( input, 10 ) : 0;

						$this.val( function() {
							return ( input === 0 ) ? "" : input.toLocaleString( "id-ID" );
						} );
			} );
			
			/**
			 * ==================================
			 * When Form Submitted
			 * ==================================
			 *
			$form.on( "submit", function( event ) {
				
				var $this = $( this );
				var arr = $this.serializeArray();
			
				for (var i = 0; i < arr.length; i++) {
						arr[i].value = arr[i].value.replace(/[($)\s\._\-]+/g, ''); // Sanitize the values.
				};
				
				console.log( arr );
				
				event.preventDefault();
			});
			*/
		});
	})(jQuery);
</script>
<div class="az-content az-content-dashboard">
  <div class="container">
	<div class="az-content-body">
	  <div class="row row-sm mg-b-20">
		<div class="col-lg-2">
		  <p class="mg-b-10">Nama</p>
		</div>
		<div class="col-lg-10">
		  <strong>
			<p>
				: <?php echo $calonsiswa->nama;?>
			</p>
		  </strong>
		</div><!-- col-4 -->
	  </div><!-- row -->
	  <div class="row row-sm mg-b-20">
		<div class="col-lg-2">
		  <p class="mg-b-10">Nomor Pendaftaran</p>
		</div>
		<div class="col-lg-10">
		  <strong>
			<p>
				: <?php echo $calonsiswa->nomor_pendaftaran;?>
			</p>
		  </strong>
		</div><!-- col-4 -->
	  </div><!-- row -->
	  <br>
	  <br>
	  <div class="az-content-label mg-b-5">Unggah Berkas</div>
	  <i style="color:#ff0000;">(minimal berkas yang diupload adalah akta kelahiran, KK, Rapor Semester 1 s/d 5 dan Surat Pernyataan Bebas Narkoba)</i>
	  <div class="row row-sm mg-b-20">
		<div class="col-lg-12">
		  <a type="submit" class="btn btn-success float-sm-right" href="<?php echo base_url();?>Pendaftaran/addBerkas">
			<i class="fa fa-upload"></i> Unggah Berkas
		  </a>
		</div><!-- col-4 -->
	  </div><!-- row --><br>
	  <div class="row row-sm mg-b-20">
		<div class="col-lg-12">
		  <div class="table-responsive">
			<table class="table table-striped mg-b-0">
			  <thead>
				<tr>
				  <th>No</th>
				  <th>Kategori Berkas</th>
				  <th>Nama Berkas</th>
				  <th>Kelola</th>
				</tr>
			  </thead>
			  <tbody>
				<?php
					if($berkas == NULL)
					{
						?>
						<td colspan="4">Tidak ada berkas.</td>
						<?php
					}
					else
					{
						$no = 0;
						foreach($berkas as $b)
						{
							$no++;
							?>
							<tr>
								<th scope="row"><?php echo $no;?></th>
								<th><?php echo $b['kategori_berkas'];?></th>
								<th><?php echo $b['nama_berkas'];?></th>
								<td>
									<a href="<?php echo base_url();?>files/calon_siswa/docs/<?php echo $b['file_berkas'];?>" target="_blank" class="btn btn-primary" download>
										<i class="typcn typcn-download"></i> Unduh										
									</a>
									<a href="<?php echo base_url();?>Pendaftaran/deleteBerkas/<?php echo $b['id_berkas'];?>" class="btn btn-danger" onclick="return confirm('Apakah Anda ingin menghapus berkas ini?');">
										<i class="typcn typcn-trash"></i> Hapus										
									</a>
								</td>
							</tr>
							<?php
						}
					}
				?>
			  </tbody>
			</table>
		  </div><!-- table-responsive -->
		</div><!-- col-4 -->
	  </div><!-- row -->
	  <br>
	  <br>
	  <div class="az-content-label mg-b-5">Unggah Bukti Pembayaran</div>
	  <form id="form" action="<?php echo base_url();?>Pendaftaran/uploadBerkasExec" method="POST" enctype="multipart/form-data">
		  <div class="row row-sm mg-b-20">
			<div class="col-lg-2">
			  <p class="mg-b-10">Bukti Pembayaran</p>
			</div>
			<div class="col-lg-4">
			  <input type="file" class="form-control" name="bukti_pembayaran" required>
			  <p style="font-size:12px; color:#FF0000;"><i>Ukuran berkas makismal 20 MB</i></p>
			</div>
		  </div><!-- row --><br>
		  <div class="row row-sm mg-b-20">
			<div class="col-lg-2">
			  <p class="mg-b-10">Nominal Pembayaran</p>
			</div>
			<div class="col-lg-4">
			  <input type="text" class="form-control" name="nominal_pembayaran" id="amount" required>
			</div>
		  </div><!-- row --><br>
		  <div class="row row-sm mg-b-20">
			<div class="col-lg-12">
			  <button type="submit" class="btn btn-az-primary float-sm-right" onclick="return confirm('Apakah Anda sudah mengunggah berkas-berkas yang dibutuhkan?\nSeperti Akta Kelahiran, Kartu Keluarga, Raport Semester 1 s/d 5, KIP/KKS/PKH, dan sertifikat-sertifikat (jika ada). \nJika sudah, silakan klik OK.\nJika belum, silakan tekan Cancel/Batal.');" <?php echo ($tombol == "mati" ? "disabled" : "");?>><i class="fa fa-print"></i> Cetak Hasil Finalisasi 
			  </button>
			</div><!-- col-4 -->
		  </div><!-- row -->
	  </form>
	</div>
  </div>
</div><!-- az-content -->