@extends('layouts.app')
@section('title', 'Riwayat Mutasi Stok')
@section('page-title', 'Riwayat Mutasi Stok')
@section('page-actions')
← Kembali
@endsection
@section('content')
{{-- Quick filters (fed into DT column search) --}}
| Waktu |
Produk |
Tipe |
Jumlah |
Keterangan |
Oleh |
|
@foreach($mutasi as $m)
|
{{ $m->created_at->format('d/m/Y H:i') }}
|
{{ $m->produk->nama }} |
{{ $m->tipe === 'masuk' ? '↑ Masuk' : '↓ Keluar' }}
|
{{ $m->jumlah }} |
{{ $m->keterangan ?? '—' }} |
{{ $m->user->name }} |
|
@endforeach
@endsection
@push('scripts')
@include('partials.dt-init', [
'tableId' => 'tbl-riwayat',
'config' => "{
order: [[0, 'desc']],
columnDefs: [
{ className: 'dtr-control', orderable: false, targets: -1 },
{ responsivePriority: 1, targets: 1 },
{ responsivePriority: 2, targets: 2 },
{ responsivePriority: 3, targets: 3 },
{ responsivePriority: 10, targets: [0, 4, 5] },
],
buttons: window.DT_EXPORT_BUTTONS,
}",
'extra' => "
// Wire the quick-filter dropdowns to DT column search
var produkSel = document.getElementById('filter-produk');
var tipeSel = document.getElementById('filter-tipe');
if (produkSel) produkSel.onchange = function() { dt.column(1).search(this.value,false,false).draw(); };
if (tipeSel) tipeSel.onchange = function() { dt.column(2).search(this.value,false,false).draw(); };
window.resetRiwayatFilter = function() {
if (produkSel) produkSel.value = '';
if (tipeSel) tipeSel.value = '';
dt.columns([1,2]).search('').draw();
};
",
])
@endpush