<?php

namespace App\Http\Controllers;

use App\Models\Payment;
use Illuminate\Http\Request;
use App\Models\Santri;
use Inertia\Inertia;
use App\Services\cekDenda;
use App\Services\GenerateMonthlyBill;

class PaymentController extends Controller
{
    public function indexManualPayment(cekDenda $cekDenda, GenerateMonthlyBill $generateMonthlyBill)
    {
        $penalty = $cekDenda->applyPenalty();
        $bill = $generateMonthlyBill->generateAutoBill();


        $santri = Santri::with([
            'payments.detailPayments.paymentType',
            'user'
        ])->get();

        // $santri = Payment::with('detailPayments')->get();

        // dd($santri);

        return Inertia::render('list-admin/payment/ManualPayment', [
            'santri' => $santri,
            'penalty' => $penalty,
            'bill' => $bill,
            'fields' => [
                'nis' => 'text',
                'nama' => 'text',
                'status_santri' => 'text',
                'role_santri' => 'text',
                'total_penalty' => 'text',
                'amount' => 'text',
            ]
        ]);
    }

    public function manualPayment() {}
}
