From e31eea70db1a4291d026c0ead9a5311b8570f141 Mon Sep 17 00:00:00 2001 From: Ashraf Monshi Date: Sun, 11 Sep 2022 16:20:02 +0300 Subject: [PATCH] small fixes set upload disk and dir set the layout from config --- resources/views/fields/file-upload.blade.php | 3 +++ .../components/view-responses.blade.php | 2 +- src/Fields/Classes/FileUpload.php | 9 +++++++++ src/Http/Livewire/FillForms.php | 8 +++++++- src/Http/Livewire/ListEntries.php | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 resources/views/fields/file-upload.blade.php diff --git a/resources/views/fields/file-upload.blade.php b/resources/views/fields/file-upload.blade.php new file mode 100644 index 00000000..dc937fb6 --- /dev/null +++ b/resources/views/fields/file-upload.blade.php @@ -0,0 +1,3 @@ + + view file + \ No newline at end of file diff --git a/resources/views/filament/resources/response-resource/components/view-responses.blade.php b/resources/views/filament/resources/response-resource/components/view-responses.blade.php index 1087d16a..22f33b21 100644 --- a/resources/views/filament/resources/response-resource/components/view-responses.blade.php +++ b/resources/views/filament/resources/response-resource/components/view-responses.blade.php @@ -38,7 +38,7 @@ @foreach($getRecord()->fieldsResponses as $resp)

{{ $resp->field->name }}

-

{{ ( new $resp->field->type )->getResponse($resp->field, $resp) }}

+

{!! ( new $resp->field->type )->getResponse($resp->field, $resp) !!}

@endforeach diff --git a/src/Fields/Classes/FileUpload.php b/src/Fields/Classes/FileUpload.php index 4c0d5812..f7548b88 100644 --- a/src/Fields/Classes/FileUpload.php +++ b/src/Fields/Classes/FileUpload.php @@ -3,6 +3,7 @@ namespace LaraZeus\Bolt\Fields\Classes; use Filament\Forms\Components\Toggle; +use Illuminate\Support\Facades\Storage; use LaraZeus\Bolt\Fields\FieldsContract; class FileUpload extends FieldsContract @@ -23,4 +24,12 @@ public static function getOptions() Toggle::make('options.is_multiple')->label(__('Allow Multiple')), ]; } + + public function getResponse($field, $resp): string + { + return view('zeus-bolt::fields.file-upload') + ->with('resp',$resp) + ->with('field',$field) + ->render(); + } } diff --git a/src/Http/Livewire/FillForms.php b/src/Http/Livewire/FillForms.php index eb4eec48..b6524b26 100644 --- a/src/Http/Livewire/FillForms.php +++ b/src/Http/Livewire/FillForms.php @@ -53,6 +53,12 @@ protected function getFormSchema() : array $setField->inline(); } } + + if($field->type == '\LaraZeus\Bolt\Fields\Classes\FileUpload'){ + $setField + ->disk(config('zeus-bolt.uploads.disk')) + ->directory(config('zeus-bolt.uploads.directory')); + } // todo so ugly change! $fields[] = Forms\Components\Card::make()->schema([ $setField ]); @@ -120,6 +126,6 @@ public function store() public function render() { - return view('zeus-bolt::forms.fill-forms')->layout('zeus::components.app'); + return view('zeus-bolt::forms.fill-forms')->layout(config('zeus-bolt.layout')); } } diff --git a/src/Http/Livewire/ListEntries.php b/src/Http/Livewire/ListEntries.php index 40458f91..89578665 100644 --- a/src/Http/Livewire/ListEntries.php +++ b/src/Http/Livewire/ListEntries.php @@ -50,6 +50,6 @@ public function fields() public function render() { - return view('zeus-bolt::forms.entries')->layout('zeus::components.app'); + return view('zeus-bolt::forms.entries')->layout(config('zeus-bolt.layout')); } }