update
This commit is contained in:
@@ -197,6 +197,22 @@ class BiorepositoryController extends Controller
|
||||
return redirect('/biorepository')->with('success', 'Spesimen berhasil disimpan ke slot terpilih.');
|
||||
}
|
||||
|
||||
public function deleteSpecimen($id)
|
||||
{
|
||||
if (Session::get('previlage') == '') {
|
||||
return redirect('/login');
|
||||
}
|
||||
|
||||
$specimen = BioSpecimen::find($id);
|
||||
if (!$specimen) {
|
||||
return redirect('/biorepository')->withErrors(['specimen' => 'Data spesimen tidak ditemukan.']);
|
||||
}
|
||||
|
||||
$specimen->delete();
|
||||
|
||||
return redirect('/biorepository')->with('success', 'Spesimen berhasil dihapus.');
|
||||
}
|
||||
|
||||
private function mapStorageCondition($category)
|
||||
{
|
||||
$mapping = [
|
||||
|
||||
@@ -223,6 +223,7 @@
|
||||
<th>Nama Rack</th>
|
||||
<th>Tgl Simpan</th>
|
||||
<th>Input By</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
@@ -240,6 +241,7 @@
|
||||
<th>Nama Rack</th>
|
||||
<th>Tgl Simpan</th>
|
||||
<th>Input By</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
@@ -258,6 +260,12 @@
|
||||
<td>{{ $row->rack->name ?? '-' }}</td>
|
||||
<td>{{ $row->stored_at }}</td>
|
||||
<td>{{ $row->input_by }}</td>
|
||||
<td class="text-center">
|
||||
<form method="POST" action="{{ route('biorepository.deleteSpecimen', $row->id) }}" class="d-inline js-delete-specimen">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm btn-danger">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@@ -478,7 +486,11 @@
|
||||
$(function () {
|
||||
$('#biorepoTable tfoot th').each(function () {
|
||||
var title = $(this).text();
|
||||
$(this).html('<input type="text" placeholder="Filter ' + title + '" />');
|
||||
if (title !== '') {
|
||||
$(this).html('<input type="text" placeholder="Filter ' + title + '" />');
|
||||
} else {
|
||||
$(this).html('');
|
||||
}
|
||||
});
|
||||
|
||||
var table = $('#biorepoTable').DataTable({
|
||||
@@ -498,6 +510,12 @@
|
||||
$('#btnOpenListTab').on('click', function () {
|
||||
$('#tabListLink').tab('show');
|
||||
});
|
||||
|
||||
$(document).on('submit', '.js-delete-specimen', function (e) {
|
||||
if (!confirm('Yakin hapus spesimen ini?')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -70,6 +70,7 @@ Route::group(['middleware' => 'project.ipg'], function() {
|
||||
Route::post('biorepository/store-cabinet', [BiorepositoryController::class, 'storeCabinet'])->name('biorepository.storeCabinet');
|
||||
Route::post('biorepository/store-rack', [BiorepositoryController::class, 'storeRack'])->name('biorepository.storeRack');
|
||||
Route::post('biorepository/store-specimen', [BiorepositoryController::class, 'storeSpecimen'])->name('biorepository.storeSpecimen');
|
||||
Route::post('biorepository/delete-specimen/{id}', [BiorepositoryController::class, 'deleteSpecimen'])->name('biorepository.deleteSpecimen');
|
||||
Route::post('simbhp/exaddbarang', [PoliController::class, 'exAddbarang'])->name('exAddBarang');
|
||||
Route::post('simbhp/reportbhp', [PoliController::class, 'jsonReportbhp'])->name('reportBHP');
|
||||
Route::post('simbhp/kwitansi', [PoliController::class, 'exKwitansi'])->name('kwitansiBHP');
|
||||
|
||||
Reference in New Issue
Block a user