feat(scanner): expose scan result labels

This commit is contained in:
2026-09-08 10:24:28 -03:00
parent a885a2fc0e
commit 531dbe52b9
2 changed files with 43 additions and 0 deletions

View File

@@ -21,6 +21,28 @@ class ScanAttemptResource extends JsonResource
'attempted_at' => $this->created_at,
'resolved_at' => $this->resolved_at,
'result' => $this->result->value,
'result_label' => match ($this->result) {
ScanAttemptResult::Processing => 'Procesando',
ScanAttemptResult::Accepted => 'Verificado',
ScanAttemptResult::InvalidQr => 'QR inválido',
ScanAttemptResult::TicketNotFound => 'Ticket inexistente',
ScanAttemptResult::CategoryForbidden => 'Categoría no permitida',
ScanAttemptResult::AlreadyScanned => 'Ya escaneado',
ScanAttemptResult::Expired => 'Vencido',
ScanAttemptResult::NotValid => 'No válido',
ScanAttemptResult::UnexpectedError => 'Error',
},
'result_detail_label' => match ($this->result) {
ScanAttemptResult::Processing => 'Error',
ScanAttemptResult::Accepted => 'Verificado',
ScanAttemptResult::InvalidQr => 'QR no pertenece al evento',
ScanAttemptResult::TicketNotFound => 'Error',
ScanAttemptResult::CategoryForbidden => 'Error',
ScanAttemptResult::AlreadyScanned => 'Usado',
ScanAttemptResult::Expired => 'Vencido',
ScanAttemptResult::NotValid => 'No válido',
ScanAttemptResult::UnexpectedError => 'Error',
},
'can_view_ticket' => $this->ticket !== null
&& $this->result !== ScanAttemptResult::CategoryForbidden,
];