components([ Section::make() ->columns(2) ->schema([ TextInput::make('name') ->label(__('panel.replies.templates.fields.name')) ->helperText(__('panel.replies.templates.fields.name_hint')) ->required() ->maxLength(255), Select::make('kind') ->label(__('panel.replies.templates.fields.kind')) ->options(ApplicationKind::options()) ->placeholder(__('panel.replies.templates.any_kind')), TextInput::make('position') ->label(__('panel.replies.templates.fields.position')) ->numeric() ->minValue(0) ->default(0), ]), Section::make() ->description(__('panel.replies.templates.placeholders', ['list' => implode(', ', ReplyTemplate::PLACEHOLDERS)])) ->schema([ TranslatableTabs::make(fn (string $locale, bool $isDefault) => [ TextInput::make("subject.{$locale}") ->label(__('panel.replies.fields.subject')) ->required($isDefault) ->maxLength(255), Textarea::make("body.{$locale}") ->label(__('panel.replies.fields.body')) ->required($isDefault) ->rows(10), ]), ]), ]); } public static function table(Table $table): Table { return $table ->defaultSort('position') ->columns([ TextColumn::make('name') ->label(__('panel.replies.templates.fields.name')) ->searchable() ->weight('bold'), TextColumn::make('kind') ->label(__('panel.replies.templates.fields.kind')) ->badge() ->formatStateUsing(fn (?string $state) => $state ? ApplicationKind::from($state)->getLabel() : __('panel.replies.templates.any_kind')) ->placeholder(__('panel.replies.templates.any_kind')), TextColumn::make('subject') ->label(__('panel.replies.fields.subject')) ->limit(60), ]) ->recordActions([ EditAction::make(), DeleteAction::make(), ]); } public static function getPages(): array { return [ 'index' => ListReplyTemplates::route('/'), 'create' => CreateReplyTemplate::route('/create'), 'edit' => EditReplyTemplate::route('/{record}/edit'), ]; } }