components([ Section::make(__('panel.applications.sections.message')) ->columns(3) ->schema([ TextEntry::make('name') ->label(__('panel.applications.fields.name')) ->weight('bold'), TextEntry::make('email') ->label(__('panel.applications.fields.email')) ->copyable() // The reply is the whole point of the record, so it is // one click away rather than a copy-paste. ->url(fn (Application $record) => 'mailto:'.$record->email), TextEntry::make('organisation') ->label(__('panel.applications.fields.organisation')) ->placeholder('—'), TextEntry::make('kind') ->label(__('panel.applications.fields.kind')) ->badge(), TextEntry::make('call_title') ->label(__('panel.applications.fields.subject')) ->state(fn (Application $record) => $record->subject()), TextEntry::make('hours_per_week') ->label(__('panel.applications.fields.hours_per_week')) ->formatStateUsing(fn (?int $state) => $state ? "{$state} h" : '—') // The number to compare against the call's own ask. ->helperText(fn (Application $record) => $record->call?->hours_per_week ? __('panel.applications.fields.hours_asked', [ 'hours' => $record->call->hours_per_week, ]) : null), TextEntry::make('message') ->label(__('panel.applications.fields.message')) ->prose() ->columnSpanFull(), KeyValueEntry::make('links') ->label(__('panel.applications.fields.links')) ->keyLabel(__('panel.applications.fields.link_name')) ->valueLabel(__('panel.applications.fields.link_url')) ->columnSpanFull() ->visible(fn (Application $record) => filled($record->links)), ]), Section::make(__('panel.applications.sections.internal')) ->description(__('panel.applications.sections.internal_hint')) ->columns(4) ->schema([ TextEntry::make('status') ->label(__('panel.applications.fields.status')) ->badge(), TextEntry::make('created_at') ->label(__('panel.applications.fields.received_at')) ->dateTime(), TextEntry::make('handler.name') ->label(__('panel.applications.fields.handled_by')) ->placeholder('—'), TextEntry::make('handled_at') ->label(__('panel.applications.fields.handled_at')) ->dateTime() ->placeholder('—'), TextEntry::make('locale') ->label(__('panel.applications.fields.locale')) ->badge() ->color('gray') // Reply in the language they wrote in. ->formatStateUsing(fn (string $state) => config("locales.supported.{$state}.native", $state)), TextEntry::make('notes') ->label(__('panel.applications.fields.notes')) ->prose() ->placeholder(__('panel.applications.fields.notes_empty')) ->columnSpanFull(), ]), ]); } }