<?php

namespace App\Http\Controllers;

use App\Domain\Financial\Models\Payment;
use App\Domain\POS\Models\POSTransaction;

class ReceiptController extends Controller
{
    public function posPrint(POSTransaction $transaction)
    {
        $transaction->load(['items', 'participant.person', 'branch', 'processedBy', 'invoice']);

        return view('print.pos-receipt', compact('transaction'));
    }

    public function paymentPrint(Payment $payment)
    {
        $payment->load(['invoice.billable.person', 'invoice.items', 'creator']);

        $payment->increment('print_count');
        $payment->update(['last_printed_at' => now()]);

        return view('print.payment-receipt', compact('payment'));
    }
}
