Commit 0134c52b by Farendi Giotivano R.P

hapus anggota

parent ea0f79b0
......@@ -72,6 +72,7 @@
<thead>
<tbody>
@foreach ($kelompok->rAnggota as $item)
@php $token = Str::random(30); @endphp
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->nama }}</td>
......@@ -85,7 +86,11 @@
Anggota {{ $loop->iteration-1 }}
@endif
</td>
<td></td>
<td>
@if($item->status_ketua != 1)
<a onclick="hapusanggota('{{ encrypt($item->kelompok_detil_id.'_'.$item->kelompok_id) }}', 'row-{{ $token }}')" class="btn btn-danger btn-sm">Hapus</a>
@endif
</td>
</tr>
@endforeach
</tbody>
......@@ -128,5 +133,47 @@
$("#addKelompok").submit();
});
function hapusanggota(id, rowId){
Swal.fire({
title: 'Apakah anda yakin untuk menghapus anggota Kelompok?',
text: "Anggota kelompok ini akan di hapus dari kelompok ini",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'OK',
}).then((result) => {
if (result.isConfirmed) {
var token = '{{ csrf_token() }}';
var request = $.ajax({
url: '{{ route('mahasiswa.anggota.hapus') }}',
type: 'POST',
dataType: 'html',
data: {id:id, _token:token},
success: function(data){
Swal.fire({
title: 'Data Berhasil Di Hapus',
icon: 'success',
showConfirmButton: false,
timer: 1500
}).then(() => {
location.reload();
$('#'+rowId).remove();
});
$('#'+rowId).remove();
},
error: function(xhr, status, error){
Swal.fire({
position: 'top-end',
icon: 'error',
title: xhr.responseText,
showConfirmButton: false,
timer: 3500
});
}
});
}
})
}
</script>
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment