<?php $__env->startSection('breadcrumb'); ?>
	<li class="breadcrumb-item">Dashboard</li>
	<li class="breadcrumb-item active">Siswa</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

	<div class="row">
		<div class="col-md-12">
			<div class="card">
				<div class="card-body">
					<div class="card-title">Data Siswa</div>
                              <a href="<?php echo e(url('dashboard/data-siswa/create')); ?>" class="btn btn-success btn-rounded float-right mb-3">
                                 <i class="mdi mdi-plus-circle"></i> <?php echo e(__('Tambah Siswa')); ?>

                              </a>
						<div class="table-responsive mb-3">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th scope="col">#</th>
                                            <th scope="col">NISN</th>
								    <th scope="col">NIS</th>
                                            <th scope="col">NAMA</th>
                                            <th scope="col">KELAS</th>
								    <th scope="col">NOMOR TELEPON</th>
								    <th scope="col">ALAMAT</th>
								    <th scope="col"></th>                                        
                                        </tr>
                                    </thead>
                                    <tbody>
								<?php 
								$i=1;
								?>
								<?php $__currentLoopData = $siswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>					    
                                            <th scope="row"><?php echo e($i); ?></th>
                                            <td><?php echo e($value->nisn); ?></td>
								    <td><?php echo e($value->nis); ?></td>
                                            <td><?php echo e($value->nama); ?></td>
                                            <td><?php echo e($value->kelas->nama_kelas); ?></td>
								    <td><?php echo e($value->nomor_telp); ?></td>
								    <td><?php echo e($value->alamat); ?></td>
                                            <td>										                           
                               	 		  <div class="hide-menu">
                                    			<a href="javascript:void(0)" class="text-dark" id="actiondd" role="button" data-toggle="dropdown">
                                       				<i class="mdi mdi-dots-vertical"></i>
                                    			</a>
                                    				<div class="dropdown-menu dropdown-menu-right" aria-labelledby="actiondd">
                                        			<a class="dropdown-item" href="<?php echo e(url('dashboard/data-siswa/'. $value->id .'/edit')); ?>"><i class="ti-pencil"></i> Edit </a>
											<form method="post" action="<?php echo e(url('dashboard/data-siswa', $value->id)); ?>" id="delete<?php echo e($value->id); ?>">
												<?php echo csrf_field(); ?>
												<?php echo method_field('delete'); ?>
												
												<button type="button" class="dropdown-item" onclick="deleteData(<?php echo e($value->id); ?>)">
													<i class="ti-trash"></i> Hapus
												</button>	
											
											</form>																																																
                                        			                    							                                                                            
                                				</div>
                            				</div>								
								    </td>					
                                        </tr>
								<?php
								$i++;
								?>
								<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>                                  
                                    </tbody>
                                </table>
                            </div>

					  <!-- Pagination -->
					<?php if($siswa->lastPage() != 1): ?>
						<div class="btn-group float-right">		
						   <a href="<?php echo e($siswa->previousPageUrl()); ?>" class="btn btn-success">
								<i class="mdi mdi-chevron-left"></i>
						    </a>
						    <?php for($i = 1; $i <= $siswa->lastPage(); $i++): ?>
								<a class="btn btn-success <?php echo e($i == $siswa->currentPage() ? 'active' : ''); ?>" href="<?php echo e($siswa->url($i)); ?>"><?php echo e($i); ?></a>
						    <?php endfor; ?>
					        <a href="<?php echo e($siswa->nextPageUrl()); ?>" class="btn btn-success">
								<i class="mdi mdi-chevron-right"></i>
							</a>
					   </div>
					<?php endif; ?>
					<!-- End Pagination -->
					
					   <?php if(count($siswa) == 0): ?>
				  			<div class="text-center"> Tidak ada data!</div>
					   <?php endif; ?>
				</div>
			</div>
		</div>
	</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('sweet'); ?>

   function deleteData(id){
      Swal.fire({
               title: 'PERINGATAN!',
               text: "Yakin ingin menghapus data siswa? data pembayaran atas nama siswa ini pun akan dihapus jika ada.",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yakin',
                cancelButtonText: 'Batal',
            }).then((result) => {
               if (result.value) {
                     $('#delete'+id).submit();
                  }
               })
   }
   
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\pembayaran-spp\resources\views/dashboard/data-siswa/index.blade.php ENDPATH**/ ?>