@extends('layout.print')
@section('title', $title)
@section('content')
<div class="card-body p-0 table-responsive">
    <table class="table table-bordered table-hover table-striped m-0">
        <thead>
            <tr>
                <th>Kode Produk</th>
                <th>Nama Produk</th>
                <th>Periode</th>
                <th>Jumlah</th>
                <th>MAPE</th>
            </tr>
        </thead>
        <tbody>
            @foreach($results as $kode_produk => $resultGroup)
                @foreach($resultGroup as $result)
                    <tr>
                        <td>{{ $kode_produk }}</td>
                        <td>{{ $produks[$kode_produk] }}</td>
                        <td>{{ date('M Y', strtotime($result->tanggal)) }}</td>
                        <td>{{ number_format($result->jumlah, 0) }}</td>
                        <td>{{ number_format($result->mape * 100, 0) }}%</td>
                    </tr>
                @endforeach
            @endforeach
        </tbody>
    </table>
</div>
@endsection
