feat(purchase,sale,ticket): expose refunded total summary in admin sales and tickets
This commit is contained in:
@@ -15,20 +15,24 @@ class AdminAppTicketCollection extends ResourceCollection
|
||||
|
||||
private readonly int $totalTickets;
|
||||
|
||||
private readonly string $refundedTotal;
|
||||
|
||||
public function __construct(AdminAppTicketResult $result)
|
||||
{
|
||||
parent::__construct($result->tickets);
|
||||
|
||||
$this->scannedTickets = $result->scannedTickets;
|
||||
$this->totalTickets = $result->totalTickets;
|
||||
$this->refundedTotal = $result->refundedTotal;
|
||||
}
|
||||
|
||||
/** @return array{scanned_tickets: int, total_tickets: int} */
|
||||
/** @return array{scanned_tickets: int, total_tickets: int, refunded_total: string} */
|
||||
public function with(Request $request): array
|
||||
{
|
||||
return [
|
||||
'scanned_tickets' => $this->scannedTickets,
|
||||
'total_tickets' => $this->totalTickets,
|
||||
'refunded_total' => $this->refundedTotal,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,6 @@ final readonly class AdminAppTicketResult
|
||||
public LengthAwarePaginator $tickets,
|
||||
public int $scannedTickets,
|
||||
public int $totalTickets,
|
||||
public string $refundedTotal,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Domains\Ticket\Services;
|
||||
|
||||
use App\Domains\Auth\Models\User;
|
||||
use App\Domains\Purchase\Models\PurchaseItem;
|
||||
use App\Domains\Purchase\Services\PurchaseRefundSummaryService;
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use App\Domains\Ticket\Models\Ticket;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -27,6 +28,7 @@ class AdminAppTicketService
|
||||
public function __construct(
|
||||
private readonly AdminAppTicketColumnService $columnService,
|
||||
private readonly AdminAppTicketRowService $rowService,
|
||||
private readonly PurchaseRefundSummaryService $refundSummaryService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -68,6 +70,7 @@ class AdminAppTicketService
|
||||
tickets: $tickets,
|
||||
scannedTickets: $scannedTickets,
|
||||
totalTickets: $totalTickets,
|
||||
refundedTotal: $this->refundSummaryService->totalForTenant($tenant),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user