feat(scanner): expose scan result labels
This commit is contained in:
@@ -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,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user