<?php
namespace App\Controllers;

use App\Controllers\BaseController;
use App\Models\PpdbModel;

class Dashboard extends BaseController
{
    public function index()
    {
        $ppdb = new PpdbModel();

        $total = $ppdb->countAllResults();
        $pending = $ppdb->where('status', 'PENDING')->countAllResults();
        $approved = $ppdb->where('status', 'APPROVED')->countAllResults();
        $rejected = $ppdb->where('status', 'REJECTED')->countAllResults();

        $data = [
            'kpi_asset'        => 0,
            'kpi_capital'      => 0,
            'kpi_shu'          => 0,
            'outstanding_loan' => 0,

            'member_active'    => 0,
            'member_nonactive' => 0,
            'saving_balance'   => 0,
            'npl'              => 0,

            'notifications' => [
                "Total Pendaftar: $total",
                "Pending: $pending",
                "Diterima: $approved",
                "Ditolak: $rejected"
            ]
        ];

        return view('dashboard/index', $data);
    }
}
