diff --git a/docs/getting-started/configuration.md b/docs/getting-started/configuration.md index 91afc415..2c1714d4 100644 --- a/docs/getting-started/configuration.md +++ b/docs/getting-started/configuration.md @@ -59,7 +59,6 @@ available resources: - CategoryResource, - CollectionResource, - FormResource, -- ResponseResource, ## Frontend Configuration diff --git a/resources/lang/ckb.json b/resources/lang/ckb.json index 20cafd3e..c47b44ec 100644 --- a/resources/lang/ckb.json +++ b/resources/lang/ckb.json @@ -180,7 +180,7 @@ "Conditional Visibility" :"بینینی مەرجدار", "show when the field:" :"نیشان بدە کەی بەشەکە:", "has the value:" :"بەهای هەیە:", - "Embed" :"جێگیرکردن:", + "Embed" :"جێگیرکردن", "Hint Text" :"دەقی ئاماژە", "Hint Icon" :"ئایکۆنی ئاماژە", "Hint Color" :"ڕەنگی ئاماژە", diff --git a/resources/lang/de.json b/resources/lang/de.json index d971d4c2..a4e840de 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -180,7 +180,7 @@ "Conditional Visibility" :"Conditional Visibility", "show when the field:" :"show when the field:", "has the value:" :"has the value:", - "Embed" :"Embed:", + "Embed" :"Embed", "Hint Text" :"Hint Text", "Hint Icon" :"Hint Icon", "Hint Color" :"Hint Color", diff --git a/resources/lang/en.json b/resources/lang/en.json index 49b4897f..00ade997 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -180,7 +180,7 @@ "Conditional Visibility" :"Conditional Visibility", "show when the field:" :"show when the field:", "has the value:" :"has the value:", - "Embed" :"Embed:", + "Embed" :"Embed", "Hint Text" :"Hint Text", "Hint Icon" :"Hint Icon", "Hint Color" :"Hint Color", diff --git a/resources/lang/fr.json b/resources/lang/fr.json index e15de8ae..40afb82f 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -180,7 +180,7 @@ "Conditional Visibility" :"Conditional Visibility", "show when the field:" :"show when the field:", "has the value:" :"has the value:", - "Embed" :"Embed:", + "Embed" :"Embed", "Hint Text" :"Hint Text", "Hint Icon" :"Hint Icon", "Hint Color" :"Hint Color", diff --git a/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php b/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php new file mode 100644 index 00000000..6021c134 --- /dev/null +++ b/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php @@ -0,0 +1,73 @@ +
{{ $resp->field->name ?? '' }}
++ {!! ( new $resp->field->type )->getResponse($resp->field, $resp) !!} +
++ {{ ($getRecord->user->name) ?? '' }} + {{ ($getRecord->user->email) ?? '' }} +
++ {{ __('created at') }}: + {{ $getRecord->created_at->format('Y.m/d') }}-{{ $getRecord->created_at->format('h:i a') }} +
+{{ __('Entry Details') }}
+{{ $resp->field->name ?? '' }}
@@ -14,72 +14,59 @@- {{ ($getRecord()->user->name) ?? '' }} - {{ ($getRecord()->user->email) ?? '' }} -
-- {{ __('created at') }}: - {{ $getRecord()->created_at->format('Y.m/d') }}-{{ $getRecord()->created_at->format('h:i a') }} -
-{{ __('Entry Details') }}
-+ {{ ($response->user->name) ?? '' }} + {{ ($response->user->email) ?? '' }} +
+ {{ __('created at') }}: + {{ $response->created_at->format('Y.m/d') }}-{{ $response->created_at->format('h:i a') }} +
+{{ __('Entry Details') }}
+{{ $zeusForm->description ?? '' }}
diff --git a/src/BoltPlugin.php b/src/BoltPlugin.php index f15edda7..ae4169a3 100644 --- a/src/BoltPlugin.php +++ b/src/BoltPlugin.php @@ -8,7 +8,6 @@ use LaraZeus\Bolt\Filament\Resources\CategoryResource; use LaraZeus\Bolt\Filament\Resources\CollectionResource; use LaraZeus\Bolt\Filament\Resources\FormResource; -use LaraZeus\Bolt\Filament\Resources\ResponseResource; final class BoltPlugin implements Plugin { @@ -26,7 +25,6 @@ public function register(Panel $panel): void ->resources([ CollectionResource::class, FormResource::class, - ResponseResource::class, CategoryResource::class, ]); } diff --git a/src/Concerns/EntriesAction.php b/src/Concerns/EntriesAction.php deleted file mode 100644 index 8c2dfb85..00000000 --- a/src/Concerns/EntriesAction.php +++ /dev/null @@ -1,44 +0,0 @@ -form_id; - - return [ - ActionGroup::make([ - Action::make('brows') - ->icon('heroicon-o-eye') - ->visible($formId !== 0) - ->label(__('Brows Entries')) - ->url(fn (): string => ResponseResource::getUrl('brows') . '?form_id=' . $formId), - Action::make('list') - ->icon('heroicon-o-bars-4') - ->visible($formId !== 0) - ->label(__('List Entries')) - ->url(fn (): string => ResponseResource::getUrl() . '?form_id=' . $formId), - Action::make('report') - ->icon('heroicon-o-document-chart-bar') - ->visible($formId !== 0) - ->label(__('Entries Report')) - ->url(fn (): string => ResponseResource::getUrl('report') . '?form_id=' . $formId), - ]) - ->button() - ->color('info') - ->label(__('Entries')) - ->tooltip(__('view all entries')) - ->icon('clarity-data-cluster-line') - ->tooltip(__('view all entries')), - ]; - } -} diff --git a/src/Concerns/Schemata.php b/src/Concerns/Schemata.php index 78e1b688..c03fb3b2 100644 --- a/src/Concerns/Schemata.php +++ b/src/Concerns/Schemata.php @@ -225,10 +225,10 @@ public static function getTabsSchema(): array Tabs\Tab::make('design') ->label(__('Design')) - ->visible(fn ( - ): bool => class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class) && config('zeus-bolt.allow_design')) + ->visible(class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class) && config('zeus-bolt.allow_design')) ->schema([ ViewField::make('options.primary_color') + ->hiddenLabel() ->view('zeus::filament.components.color-picker'), FileUpload::make('options.logo') ->disk(config('zeus-bolt.uploadDisk')) diff --git a/src/Filament/Resources/FormResource.php b/src/Filament/Resources/FormResource.php index 1418baa7..31a3c168 100644 --- a/src/Filament/Resources/FormResource.php +++ b/src/Filament/Resources/FormResource.php @@ -8,6 +8,8 @@ use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Infolist; +use Filament\Pages\SubNavigationPosition; +use Filament\Resources\Pages\Page; use Filament\Tables\Actions\Action; use Filament\Tables\Actions\ActionGroup; use Filament\Tables\Actions\DeleteAction; @@ -31,7 +33,6 @@ use LaraZeus\Bolt\Concerns\Schemata; use LaraZeus\Bolt\Filament\Actions\ReplicateFormAction; use LaraZeus\Bolt\Filament\Resources\FormResource\Pages; -use LaraZeus\Bolt\Filament\Resources\ResponseResource\Pages\ListResponses; use LaraZeus\Bolt\Models\Form as ZeusForm; class FormResource extends BoltResource @@ -47,6 +48,8 @@ class FormResource extends BoltResource protected static Closure | array | null $boltFormSchema = null; + protected static SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top; + public static function getModel(): string { return BoltPlugin::getModel('Form'); @@ -89,7 +92,6 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('description'), IconEntry::make('is_active') ->icon(fn (string $state): string => match ($state) { - '1' => 'clarity-check-circle-line', '0' => 'clarity-times-circle-solid', default => 'clarity-check-circle-line', }) @@ -121,6 +123,9 @@ public static function getBoltFormSchemaUsing(array | Closure | null $form): voi static::$boltFormSchema = $form; } + /** + * @throws \Exception + */ public static function table(Table $table): Table { return $table @@ -174,6 +179,9 @@ public static function getPages(): array 'create' => Pages\CreateForm::route('/create'), 'edit' => Pages\EditForm::route('/{record}/edit'), 'view' => Pages\ViewForm::route('/{record}'), + 'report' => Pages\ManageResponses::route('/{record}/report'), + 'browse' => Pages\BrowseResponses::route('/{record}/browse'), + 'viewResponse' => Pages\ViewResponse::route('/{record}/response/{responseID}'), ]; if (class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) { @@ -206,30 +214,52 @@ public static function getActions(): array $action = [ ViewAction::make(), EditAction::make('edit'), - Action::make('entries') - ->color('info') - ->label(__('Entries')) - ->icon('clarity-data-cluster-line') - ->tooltip(__('view all entries')) - ->url(fn (ZeusForm $record): string => ListResponses::getUrl(['form_id' => $record->id])), - Action::make('prefilledLink') - ->label(__('Prefilled Link')) - ->icon('heroicon-o-link') - ->tooltip(__('Get Prefilled Link')) - ->visible(class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) - ->url(fn (ZeusForm $record): string => FormResource::getUrl('prefilled', [$record])), ReplicateFormAction::make(), + RestoreAction::make(), DeleteAction::make(), ForceDeleteAction::make(), - RestoreAction::make(), + + ActionGroup::make([ + Action::make('entries') + ->color('warning') + ->label(__('Entries')) + ->icon('clarity-data-cluster-line') + ->tooltip(__('view all entries')) + ->url(fn (ZeusForm $record): string => url('admin/responses?form_id=' . $record->id)), + ]) + ->dropdown(false), ]; + $advancedActions = $moreActions = []; + + if (class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) { + $advancedActions[] = Action::make('prefilledLink') + ->label(__('Prefilled Link')) + ->icon('iconpark-formone-o') + ->tooltip(__('Get Prefilled Link')) + ->visible(class_exists(\LaraZeus\BoltPro\BoltProServiceProvider::class)) + ->url(fn (ZeusForm $record): string => FormResource::getUrl('prefilled', [$record])); + } + if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { //@phpstan-ignore-next-line - $action[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link') + $advancedActions[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link') + ->label(__('Short Link')) ->distUrl(fn (ZeusForm $record) => route('bolt.form.show', $record)); } - return [ActionGroup::make($action)]; + $moreActions[] = ActionGroup::make($advancedActions)->dropdown(false); + + return [ActionGroup::make(array_merge($action, $moreActions))]; + } + + public static function getRecordSubNavigation(Page $page): array + { + return $page->generateNavigationItems([ + Pages\ViewForm::class, + Pages\EditForm::class, + Pages\ManageResponses::class, + Pages\BrowseResponses::class, + ]); } } diff --git a/src/Filament/Resources/FormResource/Pages/BrowseResponses.php b/src/Filament/Resources/FormResource/Pages/BrowseResponses.php new file mode 100644 index 00000000..a4eaf764 --- /dev/null +++ b/src/Filament/Resources/FormResource/Pages/BrowseResponses.php @@ -0,0 +1,58 @@ +paginated([1]) + ->recordClasses('!bg-gray-50') + ->query(BoltPlugin::getModel('Response')::query()->where('form_id', $this->record->id)) + ->columns([ + ViewColumn::make('response') + ->label(__('Browse Entries')) + ->view('zeus::filament.resources.response-resource.pages.browse-entry'), + ]) + ->actions([ + SetResponseStatus::make(), + ], position: ActionsPosition::AfterContent) + ->filters([ + SelectFilter::make('status') + ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) + ->label(__('Status')), + ]); + } + + public static function getNavigationLabel(): string + { + return __('Browse Entries'); + } + + public function getTitle(): string + { + return __('Browse Entries'); + } +} diff --git a/src/Filament/Resources/FormResource/Pages/EditForm.php b/src/Filament/Resources/FormResource/Pages/EditForm.php index 09ca8826..219c0ea1 100644 --- a/src/Filament/Resources/FormResource/Pages/EditForm.php +++ b/src/Filament/Resources/FormResource/Pages/EditForm.php @@ -5,7 +5,6 @@ use Filament\Actions\Action; use Filament\Actions\LocaleSwitcher; use Filament\Resources\Pages\EditRecord; -use LaraZeus\Bolt\Concerns\EntriesAction; use LaraZeus\Bolt\Filament\Resources\FormResource; use LaraZeus\Bolt\Models\Form; @@ -15,7 +14,6 @@ class EditForm extends EditRecord { use EditRecord\Concerns\Translatable; - use EntriesAction; protected static string $resource = FormResource::class; @@ -23,7 +21,6 @@ protected function getHeaderActions(): array { return [ LocaleSwitcher::make(), - ...$this->getEntriesActions($this->record->id), Action::make('open') ->label(__('Open')) ->icon('heroicon-o-arrow-top-right-on-square') diff --git a/src/Filament/Resources/ResponseResource/Pages/ReportResponses.php b/src/Filament/Resources/FormResource/Pages/ManageResponses.php similarity index 55% rename from src/Filament/Resources/ResponseResource/Pages/ReportResponses.php rename to src/Filament/Resources/FormResource/Pages/ManageResponses.php index 4e42b7a5..c5f928dd 100644 --- a/src/Filament/Resources/ResponseResource/Pages/ReportResponses.php +++ b/src/Filament/Resources/FormResource/Pages/ManageResponses.php @@ -1,44 +1,32 @@ label(__('Avatar')) ->circular() ->toggleable(), + TextColumn::make('user.name') ->label(__('Name')) ->toggleable() ->sortable() ->default(__('guest')) ->searchable(), + TextColumn::make('status') ->toggleable() ->sortable() ->badge() - ->label(__('response status')) + ->label(__('status')) ->colors(BoltPlugin::getModel('FormsStatus')::pluck('key', 'color')->toArray()) ->icons(BoltPlugin::getModel('FormsStatus')::pluck('key', 'icon')->toArray()) ->grow(false) @@ -66,13 +56,14 @@ public function table(Table $table): Table TextColumn::make('notes') ->label(__('notes')) ->sortable() + ->searchable() ->toggleable(), ]; /** * @var Field $field. */ - foreach ($this->form->fields->sortBy('ordering') as $field) { + foreach ($this->record->fields->sortBy('ordering') as $field) { $getFieldTableColumn = (new $field->type)->TableColumn($field); if ($getFieldTableColumn !== null) { @@ -82,6 +73,7 @@ public function table(Table $table): Table $mainColumns[] = TextColumn::make('created_at') ->sortable() + ->searchable() ->dateTime() ->label(__('created at')) ->toggleable(); @@ -89,64 +81,49 @@ public function table(Table $table): Table return $table ->query( BoltPlugin::getModel('Response')::query() - ->where('form_id', $this->form_id) + ->where('form_id', $this->record->id) ->with(['fieldsResponses']) + ->withoutGlobalScopes([ + SoftDeletingScope::class, + ]) ) ->columns($mainColumns) ->actions([ SetResponseStatus::make(), + Tables\Actions\DeleteAction::make(), + Tables\Actions\ForceDeleteAction::make(), + Tables\Actions\RestoreAction::make(), ]) ->filters([ + Tables\Filters\TrashedFilter::make(), SelectFilter::make('status') ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) ->label(__('Status')), ]) ->bulkActions([ + Tables\Actions\DeleteBulkAction::make(), + Tables\Actions\RestoreBulkAction::make(), + Tables\Actions\ForceDeleteBulkAction::make(), + FilamentExportBulkAction::make('export') ->icon('heroicon-o-document-arrow-down') ->label(__('Export')), ]) ->recordUrl( - fn (Model $record): string => ResponseResource::getUrl('view', ['record' => $record]), + fn (Response $record): string => FormResource::getUrl('viewResponse', [ + 'record' => $record->form->slug, + 'responseID' => $record, + ]), ); } - protected function getHeaderActions(): array + public static function getNavigationLabel(): string { - return $this->getEntriesActions(); - } - - public function mount(): void - { - abort_unless(request()->filled('form_id'), 404); - - $this->form_id = request('form_id', 0); - $this->form = BoltPlugin::getModel('Form')::with(['fields'])->find($this->form_id); + return __('Entries Report'); } public function getTitle(): string { return __('Entries Report'); } - - public function getFieldResponseValue(Response $record, Field $field): string - { - $fieldResponse = $record->fieldsResponses->where('field_id', $field->id)->first(); - if ($fieldResponse === null) { - return ''; - } - - return (new $fieldResponse->field->type)->getResponse($fieldResponse->field, $fieldResponse); - } - - public function getBreadcrumbs(): array - { - $breadcrumb = $this->getBreadcrumb(); - - return [ - FormResource::getUrl() => FormResource::getBreadcrumb(), - FormResource::getUrl('view', ['record' => $this->form->slug]) => $this->form->name, - ...(filled($breadcrumb) ? [$breadcrumb] : []), - ]; - } } diff --git a/src/Filament/Resources/FormResource/Pages/ViewForm.php b/src/Filament/Resources/FormResource/Pages/ViewForm.php index 441d3194..bfdf0e59 100644 --- a/src/Filament/Resources/FormResource/Pages/ViewForm.php +++ b/src/Filament/Resources/FormResource/Pages/ViewForm.php @@ -3,10 +3,8 @@ namespace LaraZeus\Bolt\Filament\Resources\FormResource\Pages; use Filament\Actions\Action; -use Filament\Actions\EditAction; use Filament\Actions\LocaleSwitcher; use Filament\Resources\Pages\ViewRecord; -use LaraZeus\Bolt\Concerns\EntriesAction; use LaraZeus\Bolt\Filament\Resources\FormResource; use LaraZeus\Bolt\Models\Form; @@ -15,7 +13,6 @@ */ class ViewForm extends ViewRecord { - use EntriesAction; use ViewRecord\Concerns\Translatable; protected static string $resource = FormResource::class; @@ -24,8 +21,6 @@ protected function getHeaderActions(): array { return [ LocaleSwitcher::make(), - EditAction::make(), - ...$this->getEntriesActions($this->record->id), Action::make('open') ->label(__('Open')) ->icon('heroicon-o-arrow-top-right-on-square') diff --git a/src/Filament/Resources/FormResource/Pages/ViewResponse.php b/src/Filament/Resources/FormResource/Pages/ViewResponse.php new file mode 100644 index 00000000..bc0d6c1f --- /dev/null +++ b/src/Filament/Resources/FormResource/Pages/ViewResponse.php @@ -0,0 +1,77 @@ +response = Response::find($this->responseID); + static::authorizeResourceAccess(); + } + + protected function getHeaderActions(): array + { + return [ + Action::make('set-status') + ->visible(function (): bool { + return $this->response->form->extensions === null; + }) + ->label(__('Set Status')) + ->icon('heroicon-o-tag') + ->form([ + Select::make('status') + ->label(__('status')) + ->default(fn () => $this->response->status) + ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) + ->required(), + Textarea::make('notes') + ->default(fn () => $this->response->notes) + ->label(__('Notes')), + ]) + ->action(function (array $data): void { + $this->response->status = $data['status']; + $this->response->notes = $data['notes']; + $this->response->save(); + }), + ]; + } + + public function getTitle(): string | Htmlable + { + return __('view response #') . $this->response->id; + } + + public function getBreadcrumbs(): array + { + return [ + FormResource::getUrl() => FormResource::getBreadcrumb(), + FormResource::getUrl('view', ['record' => $this->record->slug]) => $this->record->name, + FormResource::getUrl('report', ['record' => $this->record->slug]) => __('Entries Report'), + __('view the entry'), + ]; + } +} diff --git a/src/Filament/Resources/ResponseResource.php b/src/Filament/Resources/ResponseResource.php deleted file mode 100644 index bf5cba55..00000000 --- a/src/Filament/Resources/ResponseResource.php +++ /dev/null @@ -1,137 +0,0 @@ -count(); - } - - public static function getModelLabel(): string - { - return __('Entries'); - } - - public static function getPluralModelLabel(): string - { - return __('Entries'); - } - - public static function getNavigationLabel(): string - { - return __('Entries'); - } - - public static function form(Form $form): Form - { - return $form - ->schema([ - ViewField::make('response') - ->view('zeus::filament.resources.response-resource.components.view-responses') - ->label('') - ->columnSpan(2), - ]); - } - - public static function table(Table $table): Table - { - return $table - ->columns([ - Split::make([ - ImageColumn::make('user.avatar') - ->circular() - ->grow(false) - ->label(__('Avatar')), - Stack::make([ - TextColumn::make('user.name') - ->label(__('User Name')) - ->searchable(), - TextColumn::make('user.email') - ->searchable() - ->label(__('User Email')) - ->wrap() - ->extraAttributes(['class' => 'text-gray-400']) - ->size('sm') - ->weight('medium') - ->icon('heroicon-s-envelope'), - ]), - ]), - TextColumn::make('form.name') - ->label(__('form')) - ->searchable() - ->visible(! request()->filled('form_id')), - Stack::make([ - TextColumn::make('created_at')->label(__('Created Date'))->dateTime()->sortable()->searchable(), - TextColumn::make('status') - ->badge() - ->label(__('status')) - ->colors(BoltPlugin::getModel('FormsStatus')::pluck('key', 'color')->toArray()) - ->icons(BoltPlugin::getModel('FormsStatus')::pluck('key', 'icon')->toArray()) - ->grow(false) - ->searchable('status'), - TextColumn::make('notes')->label(__('Notes'))->searchable(), - ]), - ]) - ->contentGrid([ - 'md' => 2, - 'xl' => 3, - ]) - ->modifyQueryUsing(function (Builder $query, Table $table) { - //@phpstan-ignore-next-line - return $query->where('form_id', $table->getLivewire()->form_id); - }) - ->defaultSort('created_at', 'description') - ->actions([ - ViewAction::make(), - SetResponseStatus::make(), - ]) - ->filters([ - SelectFilter::make('status') - ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) - ->label(__('Status')), - ]); - } - - public static function getPages(): array - { - return [ - 'brows' => Pages\BrowseResponses::route('/brows'), - 'report' => Pages\ReportResponses::route('/report'), - 'index' => Pages\ListResponses::route('/'), - 'view' => Pages\ViewResponse::route('/{record}'), - ]; - } -} diff --git a/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php b/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php deleted file mode 100644 index e7c291e1..00000000 --- a/src/Filament/Resources/ResponseResource/Pages/BrowseResponses.php +++ /dev/null @@ -1,73 +0,0 @@ -paginated([1]) - ->recordClasses('bg-gray-100') - ->query(BoltPlugin::getModel('Response')::query()->where('form_id', $this->form_id)) - ->columns([ - Tables\Columns\ViewColumn::make('response') - ->label(__('Browse Entries')) - ->view('zeus::filament.resources.response-resource.pages.show-entry'), - ]) - ->actions([ - SetResponseStatus::make(), - ], position: Tables\Enums\ActionsPosition::AfterContent) - ->filters([ - SelectFilter::make('status') - ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) - ->label(__('Status')), - ]); - } - - protected function getHeaderActions(): array - { - return $this->getEntriesActions(); - } - - public function getBreadcrumbs(): array - { - $form = BoltPlugin::getModel('Form')::findOrFail($this->form_id); - $breadcrumb = $this->getBreadcrumb(); - - return [ - FormResource::getUrl() => FormResource::getBreadcrumb(), - FormResource::getUrl('view', ['record' => $form->slug]) => $form->name, - ...(filled($breadcrumb) ? [$breadcrumb] : []), - ]; - } -} diff --git a/src/Filament/Resources/ResponseResource/Pages/ListResponses.php b/src/Filament/Resources/ResponseResource/Pages/ListResponses.php deleted file mode 100644 index 19ba7a27..00000000 --- a/src/Filament/Resources/ResponseResource/Pages/ListResponses.php +++ /dev/null @@ -1,42 +0,0 @@ -getEntriesActions(); - } - - public function getHeading(): string | Htmlable - { - return __('List Entries'); - } - - public function getBreadcrumbs(): array - { - $form = BoltPlugin::getModel('Form')::find($this->form_id); - abort_if($form === null, 404); - - return [ - FormResource::getUrl() => FormResource::getBreadcrumb(), - FormResource::getUrl('view', ['record' => $form->slug]) => $form->name, - '#' => __('List Entries'), - ]; - } -} diff --git a/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php b/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php deleted file mode 100644 index 92cbdb28..00000000 --- a/src/Filament/Resources/ResponseResource/Pages/ViewResponse.php +++ /dev/null @@ -1,46 +0,0 @@ -visible(function (): bool { - return $this->record->form->extensions === null; - }) - ->label(__('Set Status')) - ->icon('heroicon-o-tag') - ->action(function (array $data): void { - $this->record->status = $data['status']; - $this->record->notes = $data['notes']; - $this->record->save(); - }) - ->form([ - Select::make('status') - ->label(__('status')) - ->default(fn (Response $record) => $record->status) - ->options(BoltPlugin::getModel('FormsStatus')::query()->pluck('label', 'key')) - ->required(), - Textarea::make('notes') - ->default(fn (Response $record) => $record->notes) - ->label(__('Notes')), - ]), - ]; - } -} diff --git a/src/Models/Field.php b/src/Models/Field.php index 10b6ebc2..cd5363a9 100644 --- a/src/Models/Field.php +++ b/src/Models/Field.php @@ -5,7 +5,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use LaraZeus\Bolt\BoltPlugin; @@ -60,10 +59,10 @@ public function form(): BelongsTo return $this->belongsTo(BoltPlugin::getModel('Form')); } - /** @return BelongsToMany