<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;

class AdminPlatformOrderIndexLeadGovernanceQuickLinksShouldIncludePaidNoReceiptTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_index_should_include_paid_no_receipt_link_when_lead_locked(): void
    {
        $this->loginAsPlatformAdmin();

        $leadId = 12;
        $res = $this->get('/admin/platform-orders?' . Arr::query([
            'lead_id' => $leadId,
        ]));

        $res->assertOk();
        $res->assertSee('查看已付无回执（该线索）', false);

        $paidNoReceiptUrl = '/admin/platform-orders?' . Arr::query([
            'lead_id' => $leadId,
            'payment_status' => 'paid',
            'receipt_status' => 'none',
        ]);

        $res->assertSee($paidNoReceiptUrl, false);
    }
}
