@extends('layout.app')
@section('title', $title)
@section('content')
{{ dd($ma) }}
    <div class="row">
        <div class="col-md-12">
            <h3>Detail Perhitungan {{ $produk->nama_produk }}</h3>
            <div class="card card-primary card-outline mt-4">
                <div class="card-header">
                    <h3 class="card-title">Hasil Perhitungan</h3>
                </div>
                <div class="card-body p-0 table-responsive">
                    <table class="table table-bordered table-hover table-striped m-0">
                        <thead>
                            <tr>
                                <th>Tanggal</th>
                                <th>Jumlah</th>
                                <th>Forecast</th>
                                <th>Error</th>
                                <th>Error Square</th>
                                <th>Error Absolute</th>
                                <th>Error/Actual</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($ma->yt as $key => $val)
                                <tr>
                                    <td>{{ $key }}</td>
                                    <td>{{ $val }}</td>
                                    <td>{{ $ma->ft[$key] ?? '-' }}</td>
                                    <td>{{ $ma->et[$key] ?? '-' }}</td>
                                    <td>{{ $ma->et_square[$key] ?? '-' }}</td>
                                    <td>{{ $ma->et_abs[$key] ?? '-' }}</td>
                                    <td>{{ $ma->et_yt[$key] ?? '-' }}</td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
                <div class="card-footer">
                    <h5>Error Metrics:</h5>
                    <ul>
                        <li>MSE: {{ $ma->error['MSE'] }}</li>
                        <li>RMSE: {{ $ma->error['RMSE'] }}</li>
                        <li>MAE: {{ $ma->error['MAE'] }}</li>
                        <li>MAPE: {{ $ma->error['MAPE'] }}</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
@endsection
