Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions app-modules/panel-admin/lang/en/events.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php

declare(strict_types=1);

return [
'label' => 'Event',
'plural' => 'Events',

'columns' => [
'title' => 'Title',
'slug' => 'Slug',
'type' => 'Type',
'tenant' => 'Tenant',
'location' => 'Location',
'description' => 'Description',
'starts_at' => 'Starts At',
'ends_at' => 'Ends At',
'status' => 'Status',
'created_at' => 'Created At',
'date' => 'Date',
'code' => 'Code',
'event_date' => 'Event Date',
'valid_from' => 'Valid From',
'expires_at' => 'Expires At',
'uses' => 'Uses',
'revoked_at' => 'Revoked At',
],

'sections' => [
'enrollment_policy' => 'Enrollment Policy',
],

'form' => [
'enrollment_method' => 'Enrollment Method',
'check_in_method' => 'Check-in Method',
'capacity' => 'Capacity',
'waitlist_enabled' => 'Waitlist Enabled',
'attendance_requirement' => 'Attendance Requirement',
'minimum_days' => 'Minimum Days',
'cancellation_deadline_hours' => 'Cancellation Deadline (hours before event)',
'xp_on_confirmed' => 'XP on Confirmed',
'xp_on_checked_in' => 'XP on Checked-in',
'xp_on_attended' => 'XP on Attended',
'application_form_schema' => 'Application Form Schema',
'application_schema_key' => 'Field name',
'application_schema_value' => 'Field type / label',
'helpers' => [
'minimum_days' => 'Required when attendance requirement is "Minimum Days". Default 1, max = event days.',
],
],

'relations' => [
'enrollments' => 'Enrollments',
'check_in_codes' => 'Check-in Codes',
],

'enrollments' => [
'columns' => [
'participant' => 'Participant',
'waitlist' => 'Waitlist',
'enrolled_at' => 'Enrolled At',
'confirmed_at' => 'Confirmed At',
'check_in_history' => 'Check-in History',
'cancelled_at' => 'Cancelled At',
],
'actions' => [
'check_in' => 'Check In',
'check_in_selected' => 'Check In Selected',
'override_status' => 'Override Status',
'new_status' => 'New Status',
'reason' => 'Reason',
],
'notifications' => [
'participant_checked_in' => 'Participant checked in.',
'selected_participants_checked_in' => 'Selected participants checked in.',
'status_overridden' => 'Enrollment status overridden.',
],
],

'check_in_codes' => [
'actions' => [
'generate_code' => 'Generate Code',
'revoke' => 'Revoke',
],
'fields' => [
'code_length' => 'Code Length',
'generated_code' => 'Generated Code',
'max_uses' => 'Max Uses (optional)',
],
'digits' => [
'four' => '4 digits',
'six' => '6 digits',
],
'unlimited' => 'Unlimited',
'notifications' => [
'code_revoked' => 'Code revoked.',
],
],

'edit' => [
'scan_qr' => 'Scan QR',
'qr_token' => 'QR Token',
'qr_token_placeholder' => 'Scan or paste the participant token',
'check_in_submit' => 'Check In',
'participant_fallback' => 'Participant',
'notifications' => [
'check_in_success_title' => 'Check-in successful',
'check_in_success_body' => ':name has been checked in.',
'check_in_failed_title' => 'Check-in failed',
'check_in_unexpected_error' => 'An unexpected error occurred. Please try again.',
],
],
];
113 changes: 113 additions & 0 deletions app-modules/panel-admin/lang/pt_BR/events.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php

declare(strict_types=1);

return [
'label' => 'Evento',
'plural' => 'Eventos',

'columns' => [
'title' => 'Título',
'slug' => 'Slug',
'type' => 'Tipo',
'tenant' => 'Tenant',
'location' => 'Local',
'description' => 'Descrição',
'starts_at' => 'Início',
'ends_at' => 'Término',
'status' => 'Status',
'created_at' => 'Criado em',
'date' => 'Data',
'code' => 'Código',
'event_date' => 'Data do evento',
'valid_from' => 'Válido de',
'expires_at' => 'Expira em',
'uses' => 'Usos',
'revoked_at' => 'Revogado em',
],

'sections' => [
'enrollment_policy' => 'Política de inscrição',
],

'form' => [
'enrollment_method' => 'Método de inscrição',
'check_in_method' => 'Método de check-in',
'capacity' => 'Capacidade',
'waitlist_enabled' => 'Lista de espera habilitada',
'attendance_requirement' => 'Requisito de presença',
'minimum_days' => 'Dias mínimos',
'cancellation_deadline_hours' => 'Prazo de cancelamento (horas antes do evento)',
'xp_on_confirmed' => 'XP ao confirmar',
'xp_on_checked_in' => 'XP no check-in',
'xp_on_attended' => 'XP ao comparecer',
'application_form_schema' => 'Schema do formulário de inscrição',
'application_schema_key' => 'Nome do campo',
'application_schema_value' => 'Tipo / rótulo do campo',
'helpers' => [
'minimum_days' => 'Obrigatório quando o requisito de presença é "Dias mínimos". Padrão 1, máximo = dias do evento.',
],
],

'relations' => [
'enrollments' => 'Inscrições',
'check_in_codes' => 'Códigos de check-in',
],

'enrollments' => [
'columns' => [
'participant' => 'Participante',
'waitlist' => 'Lista de espera',
'enrolled_at' => 'Inscrito em',
'confirmed_at' => 'Confirmado em',
'check_in_history' => 'Histórico de check-in',
'cancelled_at' => 'Cancelado em',
],
'actions' => [
'check_in' => 'Fazer check-in',
'check_in_selected' => 'Check-in selecionados',
'override_status' => 'Alterar status',
'new_status' => 'Novo status',
'reason' => 'Motivo',
],
'notifications' => [
'participant_checked_in' => 'Participante com check-in realizado.',
'selected_participants_checked_in' => 'Participantes selecionados com check-in realizado.',
'status_overridden' => 'Status da inscrição alterado.',
],
],

'check_in_codes' => [
'actions' => [
'generate_code' => 'Gerar código',
'revoke' => 'Revogar',
],
'fields' => [
'code_length' => 'Tamanho do código',
'generated_code' => 'Código gerado',
'max_uses' => 'Máximo de usos (opcional)',
],
'digits' => [
'four' => '4 dígitos',
'six' => '6 dígitos',
],
'unlimited' => 'Ilimitado',
'notifications' => [
'code_revoked' => 'Código revogado.',
],
],

'edit' => [
'scan_qr' => 'Escanear QR',
'qr_token' => 'Token QR',
'qr_token_placeholder' => 'Escaneie ou cole o token do participante',
'check_in_submit' => 'Fazer check-in',
'participant_fallback' => 'Participante',
'notifications' => [
'check_in_success_title' => 'Check-in realizado',
'check_in_success_body' => ':name fez check-in com sucesso.',
'check_in_failed_title' => 'Falha no check-in',
'check_in_unexpected_error' => 'Ocorreu um erro inesperado. Tente novamente.',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ final class EventResource extends Resource

protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;

public static function getNavigationLabel(): string
{
return __('panel-admin::events.plural');
}

public static function getModelLabel(): string
{
return __('panel-admin::events.label');
}

public static function getPluralModelLabel(): string
{
return __('panel-admin::events.plural');
}

public static function form(Schema $schema): Schema
{
return EventForm::configure($schema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ protected function getHeaderActions(): array
{
return [
Action::make('scanQr')
->label('Scan QR')
->label(__('panel-admin::events.edit.scan_qr'))
->icon(Heroicon::QrCode)
->color('success')
->schema([
TextInput::make('token')
->label('QR Token')
->label(__('panel-admin::events.edit.qr_token'))
->required()
->autofocus()
->placeholder('Scan or paste the participant token'),
->placeholder(__('panel-admin::events.edit.qr_token_placeholder')),
])
->modalSubmitActionLabel('Check In')
->modalSubmitActionLabel(__('panel-admin::events.edit.check_in_submit'))
->action(function (array $data): void {
/** @var Event $event */
$event = $this->getRecord();
Expand All @@ -58,24 +58,26 @@ protected function getHeaderActions(): array
);

$checkIn->enrollment->loadMissing('user');
$participantName = $checkIn->enrollment->user->name ?? 'Participant';
$participantName = $checkIn->enrollment->user->name ?? __('panel-admin::events.edit.participant_fallback');

Notification::make()
->success()
->title('Check-in successful')
->body($participantName.' has been checked in.')
->title(__('panel-admin::events.edit.notifications.check_in_success_title'))
->body(__('panel-admin::events.edit.notifications.check_in_success_body', [
'name' => $participantName,
]))
->send();
} catch (CheckInException $e) {
Notification::make()
->danger()
->title('Check-in failed')
->title(__('panel-admin::events.edit.notifications.check_in_failed_title'))
->body($e->getMessage())
->send();
} catch (Throwable $e) {
Notification::make()
->danger()
->title('Check-in failed')
->body('An unexpected error occurred. Please try again.')
->title(__('panel-admin::events.edit.notifications.check_in_failed_title'))
->body(__('panel-admin::events.edit.notifications.check_in_unexpected_error'))
->send();

report($e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class GenerateCheckInCodeAction extends Action
protected function setUp(): void
{
parent::setUp();
$this->label('Generate Code')
$this->label(__('panel-admin::events.check_in_codes.actions.generate_code'))
->icon(Heroicon::OutlinedPlusCircle)
->color('success')
->schema($this->generateFormSchema(...))
Expand Down Expand Up @@ -70,10 +70,10 @@ private function generateFormSchema(RelationManager $livewire): array
->columns(2)
->schema([
Select::make('digits')
->label('Code Length')
->label(__('panel-admin::events.check_in_codes.fields.code_length'))
->options([
'4' => '4 digits',
'6' => '6 digits',
'4' => __('panel-admin::events.check_in_codes.digits.four'),
'6' => __('panel-admin::events.check_in_codes.digits.six'),
])
->default('6')
->live()
Expand All @@ -84,35 +84,35 @@ private function generateFormSchema(RelationManager $livewire): array
->required(),

TextInput::make('code_preview')
->label('Generated Code')
->label(__('panel-admin::events.check_in_codes.fields.generated_code'))
->readOnly()
->default(fn (): string => $this->generateNumericCode(6))
->dehydrated()
->required(),

DatePicker::make('event_date')
->label('Event Date')
->label(__('panel-admin::events.columns.event_date'))
->default($event->starts_at->toDateString())
->minDate($event->starts_at->toDateString())
->maxDate($event->ends_at->toDateString())
->required(),

DateTimePicker::make('starts_at')
->label('Valid From')
->label(__('panel-admin::events.columns.valid_from'))
->default(now())
->required(),

DateTimePicker::make('expires_at')
->label('Expires At')
->default(now()->addHours(2))
->label(__('panel-admin::events.columns.expires_at'))
->afterOrEqual('starts_at')
->default(now()->addHours(2))
->required(),

TextInput::make('max_uses')
->label('Max Uses (optional)')
->label(__('panel-admin::events.check_in_codes.fields.max_uses'))
->numeric()
->minValue(1)
->placeholder('Unlimited'),
->placeholder(__('panel-admin::events.check_in_codes.unlimited')),
]),
];
}
Expand Down
Loading