<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>


<?php if ($ac == '') { ?>
<div class='row'>
	 <div class='col-md-12'>
             <div class="card">
             <div class="card-header">
			 <div class='right '>
					  <a href="?pg=inputproyek&ac=tambah" class='btn btn-outline-primary btn-sm' ><i class="fa fa-plus-circle"></i> Dimensi</a>
                </div>
                  <h5 class='card-title'><i class="fas fa-graduation-cap"></i> Proyek Penguatan Profil Pelajar Pancasila</h5>
                </div>
				
				 <div class='box-body'>
				 <div class='card-body'>
             <div class="alert alert-custom" role="alert">
               <div class="custom-alert-icon icon-dark"><i class="fa fa-check fa-2x"></i></div>
                 <div class="alert-content">
                  <span class="alert-text" style="text-align:justify">
                 Jika setiap Proyek <b>belum memenuhi 5 Dimensi dan Elemen</b> <b style="color:red"> maka tombol input nilai tidak muncul</b>         
							   </span>
                            </div>
                                </div>
                                <div class='card-body'>
                    <div class='table-responsive'>
                        <table  id='example1' class='table table-hover'>
                            <thead >
                                <tr>
                                    <th width='3px' class="hidden-xs">No</th>
									  <th width="10%">Kelas</th>
									   <th width='5%'>Proyek</th>
                                    <th>Judul Proyek</th>  
									<th>Dimensi</th>  
                               		<th>Elemen</th>
									<th>Sub Elemen</th>									
									<th width='20%' style="text-align:center">Action</th>
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no = 0;
								
								 $query = mysqli_query($koneksi, "select * FROM proyek");
                            while ($p = mysqli_fetch_array($query)) {
							$pro=fetch($koneksi,'m_proyek',['id'=>$p['p_proyek']]);
							$dim=fetch($koneksi,'m_dimensi',['id_dimensi'=>$p['p_dimensi']]);
							$el=fetch($koneksi,'m_elemen',['id_elemen'=>$p['p_elemen']]);
							$sub=fetch($koneksi,'m_sub_elemen',['id_sub'=>$p['p_sub']]);
							$nilai = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM nilai_proyek WHERE idproyek='$p[idp]'"));
							$dimensi = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM proyek WHERE kelas='$p[kelas]' AND p_proyek='$p[p_proyek]'"));
                                $no++;
                            ?>
							 <tr>
                                    <td><?= $no; ?></td>
							        <td><b style="color:blue;"><?= $p['kelas'] ?></b></td>
									<td ><b style="color:blue;"><?= $pro['ke'] ?></b></td>
									<td ><?= $pro['judul'] ?></td>
									<td><b style="color:blue;"><?= $dim['dimensi'] ?></b></td>
                                   <td><?= $el['elemen'] ?></td>
								   <td><?= $sub['sub_elemen'] ?></td>
								   <td style="text-align:center">
								   <?php if($dimensi==5): ?>
								   
                                     <?php if($nilai==0){ ?>  
										 <button data-id="<?= $p['idp'] ?>" class="hapus btn-sm btn btn-outline-danger" data-bs-placement="top" data-bs-toggle="tooltip" title="Hapus Dimensi"><i class="fas fa-times-circle"></i></button>
                                  
								  <a href="?pg=inputproyek&ac=nilai&id=<?= $p['idp'] ?>" class='btn btn-outline-success btn-sm' data-bs-placement="top" data-bs-toggle="tooltip" title="Input Nilai"><i class="fa fa-plus-circle"></i></a>
						         <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
								 <?php }else{  ?>
								  <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
								   <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
										   <a href="?pg=inputproyek&ac=lihatnilai&id=<?= $p['idp'] ?>" class='btn btn-outline-success btn-sm' data-bs-placement="top" data-bs-toggle="tooltip" title="Lihat Nilai"><i class="fa fa-check-circle"></i></a>
								  <?php } ?>
								  <?php else : ?>
								  <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
										  <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
										  <button type="button" class="btn btn-sm btn-default" disabled>
                                          <i class="fas fa-lock" ></i></button>
								  <?php endif; ?>
								   </td>
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                    </div>
                    </div>
					</div>
                    </div>
					
					<script>
		$('#example1').on('click', '.hapus', function() {
        var id = $(this).data('id');
        console.log(id);
        swal({
            title: 'Are you sure?',
            text: 'Akan menghapus data ini!',
			type:'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'iya, hapus'
        }).then((result) => {
            if (result.value) {
                $.ajax({
                    url: 'sandik_proyek/crud_proyek.php?pg=hapus_proyek',
                    method: "POST",
                    data: 'id=' + id,
                    success: function(data) {
                        iziToast.success({
                            title: 'Sukses!',
                            message: 'Data Berhasil dihapus',
                            position: 'topRight'
                        });
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    }
                });
            }
            return false;
        })

    });
	</script>
					
<?php } elseif ($ac == 'tambah') { ?>
    <div class='row'>
	 <div class='col-md-12'>
               <div class="card">
             <div class="card-header">
                  <h5 class='card-title'><i class="fas fa-graduation-cap"></i> Proyek Penguatan Profil Pelajar Pancasila</h5>
                </div>
				<div class='card-body'>
             <div class="alert alert-custom" role="alert">
               <div class="custom-alert-icon icon-dark"><i class="fa fa-check fa-2x"></i></div>
                 <div class="alert-content">
                  <span class="alert-text" style="text-align:justify">
                 Jika input master Proyek tiap kelas <b>belum memenuhi 3 Proyek,</b> <b style="color:red"> maka tombol input nilai tidak muncul</b>         
							  </span>
                            </div>
                                </div>
                                <div class='card-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table table-hover'>
                            <thead >
                                <tr>
                                    <th width='3px' class="hidden-xs">No</th>
									  <th>Kelas</th>
									   <th width='5px'>Fase</th>
									    <th>Proyek</th>
                                    <th>Judul Proyek</th>  
									<th>Deskripsi</th>  
                               		<th width="5%">Jml Dimensi</th>  					  
									<th width='10%'>Action</th>
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no = 0;
								
								 $query = mysqli_query($koneksi, "select * FROM m_proyek");
                            while ($tjn = mysqli_fetch_array($query)) {
							$nilai = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM m_proyek WHERE kelas='$tjn[kelas]'"));
                            $dimensi = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM proyek WHERE kelas='$tjn[kelas]' AND p_proyek='$tjn[id]'"));
							$no++;
                            ?>
							 <tr>
                                    <td><?= $no; ?></td>
							        <td><?= $tjn['kelas'] ?></td>
									<td ><?= $tjn['fase'] ?></td>
									<td>
									<?php if($dimensi==5): ?>
									<b style="color:blue;"><?= $tjn['ke'] ?></b>
									<?php else: ?>
									<b style="color:red;" class="siskolah"><?= $tjn['ke'] ?></b>
									<?php endif; ?>
									</td>
									<td ><?= $tjn['judul'] ?></td>
									<td><?= $tjn['deskripsi'] ?></td>
									<td>
									 <?php if($dimensi==5): ?>
									<b style="color:blue;"><?= $dimensi ?></b>
									<?php else: ?>
									<b style="color:red;" class="siskolah"><?= $dimensi ?></b>
									<?php endif; ?>
									</td>
                                   <td style="text-align:center">
								   <?php if($dimensi==5): ?>
								   <button type="button" class="btn btn-sm btn-default btn-rounded" disabled>
                                          <i class="fas fa-lock" ></i></button>
								   <?php else: ?>
								   <?php if($nilai==3){ ?>
                                      <a href="?pg=inputproyek&ac=input&id=<?= $tjn['id'] ?>" class='btn btn-outline-success btn-sm' data-placement="top" data-toggle="tooltip" data-original-title="Pilih Proyek" ><i class="fa fa-plus-circle"></i> </button></a>
								   <?php }else{  ?>
									<b style="color:red;">Belum 3 proyek</b>
								   <?php } ?>
								   <?php endif; ?>
                                   </td>
								  
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
                    </div>
                    </div>
					</div>
                    </div>
					
	<?php } elseif ($ac == 'input') { ?>
	
<?php
$id=$_GET['id'];
$proyek=fetch($koneksi,'m_proyek',['id'=>$id]);
?>
<div class='row'>

        <div class='col-md-12'>
            <div class="card">
             <div class="card-header">
                  <h5 class='card-title'><i class="fas fa-school"></i> Input Dimensi Proyek</h5>
				  </div>    
			  
						<div class="card-body">
						<form id="formtujuan" action=''  class="form-horizontal" >
             
								<input type="hidden" name="proyek" value="<?= $_GET['id'] ?>" >	
						   <div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Kelas</label>
							<div class="col-sm-9">
							<select name='kelas' class='form-control' style="width:30%;" readonly>
                             <option value="<?= $proyek['kelas'] ?>"><?= $proyek['kelas'] ?></option>
                               
                                                </select>
                                            </div>
                                        </div>
							<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Fase</label>
							<div class="col-sm-9">
							<select name='fase' class='form-control' style="width:30%;" readonly>
                             <option value="<?= $proyek['fase'] ?>"><?= $proyek['fase'] ?></option>
                               
                                                </select>
                                            </div>
                                        </div>
							<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Judul</label>
							<div class="col-sm-9">
							    <input type='text' name='judul' value="<?= $proyek['judul'] ?>" class='form-control' style="width:100%;" readonly />
                                            </div>
						            </div>
							<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Deskripsi</label>
							<div class="col-sm-9">
							    <input type='text' name='deskripsi' value="<?= $proyek['deskripsi'] ?>" class='form-control' style="width:100%;" readonly />
                                            </div>
						            </div>	
							
							<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Dimensi</label>
							<div class="col-sm-9">
							 <select name='dimensi' id="dimensi" class='form-select' required='true' style="width:100%;">
							 <option value=''>Pilih Dimensi</option>
							  
                                 <?php $quem = mysqli_query($koneksi, "SELECT * FROM m_dimensi"); ?>
                                     <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                         <option value="<?= $m['id_dimensi'] ?>"><?= $m['dimensi'] ?></option>
                                                <?php endwhile ?>
                                                    </select>
                                                    
                                       </div>
						            </div>
								<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Elemen</label>
							<div class="col-sm-9">
							 <select name='elemen' id="elemen" class='form-select' required='true' style="width:100%;">
							 <option value=''>Pilih Elemen</option>
							  
                                </select>
                                       </div>
						            </div>
								<div class="row mb-2">
							<label  class="col-md-3 col-form-label bold">Sub Elemen</label>
							<div class="col-sm-9">
							 <select name='sub_elemen' id="sub_elemen" class='form-select' required='true' style="width:100%;">
							 <option value=''>Pilih Sub Elemen</option>
							  
                                </select>
                                       </div>
						            </div>
									<p>
								<div class="right">
					   <button type='submit' name='submit' class='btn btn-success'><i class='fa fa-check-circle' ></i> Simpan</button>                                  
					 </div>
									    </form>
								            </div>
											</div>
											</div>
											
								          </div>
                                        </div>
                                    </div>
                                </div>
								<script>
				  $("#dimensi").change(function() {
					var dimensi = $(this).val();
					console.log(dimensi);
					$.ajax({
						type: "POST", 
						url: "sandik_proyek/crud_proyek.php?pg=ambil_elemen", 
						data: "dimensi=" + dimensi, 
						success: function(response) { 
							$("#elemen").html(response);
						}
					});
				});						
			</script>	
			<script>
				  $("#elemen").change(function() {
					var elemen = $(this).val();
					console.log(elemen);
					$.ajax({
						type: "POST", 
						url: "sandik_proyek/crud_proyek.php?pg=ambil_sub_elemen", 
						data: "elemen=" + elemen, 
						success: function(response) { 
							$("#sub_elemen").html(response);
						}
					});
				});						
			</script>		
	<script>
	 $('#formtujuan').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'sandik_proyek/crud_proyek.php?pg=tambah_proyek',
            data: $(this).serialize(),
            beforeSend: function() {
                $('form button').on("click", function(e) {
                    e.preventDefault();
                });
            },
            success: function(data) {
                console.log(data);
                if (data == 'OK') {
                   iziToast.info(
            {
                title: 'Sukses!',
                message: 'Data berhasil disimpan',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
                    setTimeout(function() {
                        window.location.replace('?pg=inputproyek');
                    }, 2000);
                } else {
                  iziToast.info(
            {
                title: 'GAGAL!',
                message: 'Dimensi Elemen Sudah Ada',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
					setTimeout(function() {
                        window.location.replace('?pg=inputproyek');
                    }, 2000);
                }

            }
        });
        return false;
    });
	
	</script>
	
	<?php } elseif ($ac == 'nilai') { ?>
	<?php 
	$projek=fetch($koneksi,'proyek',['idp'=>$_GET['id']]); 
	$kelas=$projek['kelas'];
	$ket=fetch($koneksi,'m_proyek',['id'=>$projek['p_proyek']]);
	?>
	
    <div class='row'>
	 <div class='col-md-12'>
              <div class="card">
             <div class="card-header">
                  <h5 class='card-title'><i class="fas fa-graduation-cap"></i> Input Nilai Proyek Kelas <?= $kelas ?></h5>
                </div>
				
        <div class='card-body'>
                    <h5 class='card-title'>Proyek Penguatan Profil Pelajar Pancasila <b style="color:blue;">(<?= $ket['ke'] ?>)</b></h5>
                   
					<form id="formtujuan" action=''>              
                    <div class='table-responsive'>
                        <table style="font-size: 12px" id='nilai' class='table table-bordered'>
                            <thead >
                                <tr>
                                    <th width='3px'>No</th>
									<th width="10%">N I S</th>
									  <th>Nama</th>
									  <th width="10%">Kelas</th>
									  <th width="10%">Kelamin</th>
									   <?php
			$querys = mysqli_query($koneksi,"select * from proyek 
			JOIN m_sub_elemen ON m_sub_elemen.id_sub=proyek.p_sub
			WHERE proyek.idp='$_GET[id]' ");
              while ($kd = mysqli_fetch_array($querys)) {
			$kelasQ = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM siswa  WHERE id_kelas='$kd[kelas]'"));
			
			?>
			<th width="40%" style="text-align: center;">
			<?php if($kelasQ['fase']=='A'): ?>
			<?= $kd['A'] ?>
			<?php elseif($kelasQ['fase']=='B'): ?>
			<?= $kd['B'] ?>
			<?php elseif($kelasQ['fase']=='C'): ?>
			<?= $kd['C'] ?>
			<?php elseif($kelasQ['fase']=='D'): ?>
			<?= $kd['D'] ?>
			<?php elseif($kelasQ['fase']=='E'): ?>
			<?= $kd['E'] ?>
			<?php endif; ?>
			</th>
			  <?php } ?>
							
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no = 0;
								
								 $query = mysqli_query($koneksi, "select * FROM siswa WHERE id_kelas='$kelas'");
                            while ($siswa = mysqli_fetch_array($query)) {
							
                                $no++;
                            ?>
							 <tr>
                                    <td><?= $no; ?></td>
							        <td><?= $siswa['nis'] ?></td>
									<td><?= $siswa['nama'] ?></td>
									<td><?= $siswa['id_kelas'] ?></td>
									<td><?= $siswa['jenis_kelamin'] ?>
									<input type="hidden" name="ids[]" value="<?= $siswa['id_siswa'] ?>">
									<input type="hidden" name="kelas[]" value="<?= $siswa['id_kelas'] ?>">
									<input type="hidden" name="proyek[]" value="<?= $_GET['id'] ?>">
									<input type="hidden" name="ketproyek[]" value="<?= $projek['p_proyek'] ?>">
									</td>
									<td >
									<select name='nilai[]' class='form-select' required='true'>
                                       <option value=''></option>
                                          <?php $quem = mysqli_query($koneksi, "SELECT * FROM m_nilai_proyek"); ?>
                                                <?php while ($m = mysqli_fetch_array($quem)) : ?>
                                                    <option value="<?= $m['nilai'] ?>"><?= $m['ket'] ?></option>
                                                <?php endwhile ?>
                                                    </select>
                                               
									</td>
									
								  
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
						<div class='right '>
		             <button type='submit'  class='btn btn-success'><i class='fa fa-check-circle'></i> Simpan</button>
                    </div>
					 </form>	
                    </div>
                    </div>
					</div>
                    </div>
					
					<script>
	 $('#formtujuan').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
      
        $.ajax({
            type: 'POST',
            url: 'sandik_proyek/crud_nilai.php?pg=tambah',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
                iziToast.info(
            {
                title: 'Sukses!',
                message: 'Data berhasil disimpan',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
                setTimeout(function() {
                    window.location.replace('?pg=inputproyek');
                }, 2000);

            }
        });
        return false;
    });
	</script>
	
	<?php } elseif ($ac == 'lihatnilai') { ?>
	<?php 
	$idp=$_GET['id'];
	$projek=fetch($koneksi,'proyek',['idp'=>$_GET['id']]); 
	$kelas=$projek['kelas'];
	$ket=fetch($koneksi,'m_proyek',['id'=>$projek['p_proyek']]); 
	$dim=fetch($koneksi,'m_dimensi',['id_dimensi'=>$projek['p_dimensi']]); 
	?>
	
    <div class='row'>
	 <div class='col-md-12'>
              <div class="card">
             <div class="card-header">     
                    <div class='right '>
					<button id="btnkosongnilai" data-id="<?= $idp ?>" class='btn btn-sm btn-outline-danger'><i class='fa fa-trash'></i>Hapus</button>   
                    </div>
					 <h5 class='card-title'><i class="fas fa-graduation-cap"></i> Nilai Proyek Kelas <?= $kelas ?></h5>
                </div>
				
				 <div class='card-body'>
                    <h5 class='card-title'><?= $ket['judul'] ?> <b style="color:blue;">(<?= $ket['ke'] ?>)</b> <small>Dimensi <?= $dim['dimensi'] ?></small></h5>                   
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table table-bordered'>
                            <thead >
                                <tr>
                                    <th width='3px'>No</th>
									<th width="10%">N I S</th>
									  <th>Nama</th>
									  <th width="10%">Kelas</th>
									  <th width="10%">Kelamin</th>
									   <?php
			$querys = mysqli_query($koneksi,"select * from proyek 
			JOIN m_sub_elemen ON m_sub_elemen.id_sub=proyek.p_sub
			WHERE idp='$_GET[id]' ");
              while ($kd = mysqli_fetch_array($querys)) {
			?>
			<th style="text-align: center;" ><?= $kd['capaian'] ?></th>
			  <?php } ?>
			   <th>Action</th>
										</tr>
									</thead>							
							<tbody>							
                                <?php
								$no = 0;
								
								 $query = mysqli_query($koneksi, "select * FROM siswa WHERE id_kelas='$kelas'");
                            while ($siswa = mysqli_fetch_array($query)) {
							$nl=fetch($koneksi,'nilai_proyek',['idsiswa'=>$siswa['id_siswa'],'idproyek'=>$_GET['id']]);
							$ket = fetch($koneksi,'m_nilai_proyek',['nilai'=>$nl['nilai']]);
                                $no++;
                            ?>
							 <tr>
                                    <td><?= $no; ?></td>
							        <td><?= $siswa['nis'] ?></td>
									<td><?= $siswa['nama'] ?></td>
									<td><?= $siswa['id_kelas'] ?></td>
									<td><?= $siswa['jenis_kelamin'] ?></td>
									<td style="text-align: center;color:blue"><b><?= $ket['nilai'] ?> ( <?= $ket['ket'] ?> )</b></td>
									<td>
									  <button type="button" class="btn btn-outline-primary btn-sm" data-bs-toggle="modal" data-bs-target="#modaledit<?= $no ?>">
                                                    <i class="fas fa-edit"></i>
                                     </td>
									<div class="modal fade" id="modaledit<?= $no ?>" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                  <div class='modal-header'>
												  <h5 class="card-title">Edit Nilai</h5>
                                    <button class='close' data-bs-dismiss='modal'>
									<span aria-hidden='true'><i class='fa fa-times'></i></span></button>
                                  
                                         </div>
										 <div class='modal-body'>
                                                <form id="formedit<?= $no ?>">
												<input type="hidden" name="id" value="<?= $nl['idn'] ?>" >
												
													<div class="col-md-12">
														  <label class="bold">Nama Siswa</label>
														<input type="text" class='form-control' value="<?= $siswa['nama'] ?>" readonly>
														 </div>   
														
														<div class="col-md-12">
														  <label class="bold">Kelas</label>
														<input type="text" class='form-control' value="<?= $siswa['id_kelas'] ?>" readonly>
														 </div>   
														
														<div class="col-md-12">
														  <label class="bold">Nilai Proyek</label>
														<select name='nilai' class='form-select' required='true'>
													   <option value=''></option>
														  <?php $quem = mysqli_query($koneksi, "SELECT * FROM m_nilai_proyek"); ?>
																<?php while ($m = mysqli_fetch_array($quem)) : ?>
																	<option value="<?= $m['nilai'] ?>"><?= $m['ket'] ?></option>
																<?php endwhile ?>
																	</select>
                                               
														 </div>  
												<p>
                                            <div class='right' >
                                                <button type='submit' class='btn btn-success'><i class='fa fa-check-circle'></i> Simpan</button>
                             
                                        </div>
										
                                    </form>
                                            </div>
                                        </div>
                                    </div>
                                    <script>
                        $("#formedit<?= $no ?>").submit(function(e) {
                            e.preventDefault();
                          var data = new FormData(this);
      
						$.ajax({
							type: 'POST',
							url: 'sandik_proyek/crud_proyek.php?pg=edit_nilai',
							 enctype: 'multipart/form-data',
								data: data,
								cache: false,
								contentType: false,
								processData: false,
								success: function(data) {
									 iziToast.info(
								{
									title: 'Sukses!',
									message: 'Data berhasil disimpan',
									titleColor: '#FFFF00',
									messageColor: '#fff',
									backgroundColor: 'rgba(0, 0, 0, 0.5)',
									 progressBarColor: '#FFFF00',
									  position: 'topRight'
										});
									setTimeout(function() {
										window.location.reload();
									}, 2000);

								}
							});
							return false;
						});
                    </script>
   			
								  
							       </tr>
                            <?php } ?>
                        </tbody>
                        </table>
							
                    </div>
                    </div>
					</div>
                    </div>
					<script>
		$("#btnkosongnilai").click(function() {
        var id = $(this).data('id');
        swal({
            title: 'Konfirmasi ',
            text: 'Apakah akan menhapus semua nilai ini ??',
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Ya, Hapus!'
        }).then((result) => {
            if (result.value) {
                $.ajax({
                    url: 'sandik_proyek/crud_proyek.php?pg=reset',
                    data: "id=" + id,
                    type: "POST",
                    success: function(respon) {
                       iziToast.info(
            {
                title: 'Sukses!',
                message: 'Data berhasil dihapus',
				titleColor: '#FFFF00',
				messageColor: '#fff',
				backgroundColor: 'rgba(0, 0, 0, 0.5)',
				 progressBarColor: '#FFFF00',
                  position: 'topRight'
                    });
                        setTimeout(function() {
                            location.replace('?pg=inputproyek');
                        }, 2000);
                    }
                })
            }
        });
        return false;
    })
	</script>
	
	<?php } ?>