diff --git a/app/Form/Actions/FormStoreAction.php b/app/Form/Actions/FormStoreAction.php index dd4b0c68..39fb8f4d 100644 --- a/app/Form/Actions/FormStoreAction.php +++ b/app/Form/Actions/FormStoreAction.php @@ -39,10 +39,10 @@ class FormStoreAction */ public function handle(array $attributes): Form { - return tap( - Form::create($attributes), - fn ($form) => $form->setDeferredUploads(request()->input('header_image')) - ); + return tap(Form::create($attributes), function ($form) { + $form->setDeferredUploads(request()->input('header_image')); + $form->setDeferredUploads(request()->input('mailattachments')); + }); } /** diff --git a/app/Form/Models/Form.php b/app/Form/Models/Form.php index 08274267..63930608 100644 --- a/app/Form/Models/Form.php +++ b/app/Form/Models/Form.php @@ -4,13 +4,10 @@ namespace App\Form\Models; use App\Form\Data\FieldCollection; use App\Form\Data\FormConfigData; -use App\Form\Fields\Field; use Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Support\Arr; -use Illuminate\Support\Collection; use Laravel\Scout\Searchable; use Spatie\Image\Manipulations; use Spatie\MediaLibrary\HasMedia; @@ -65,6 +62,7 @@ class Form extends Model implements HasMedia ->registerMediaConversions(function (Media $media) { $this->addMediaConversion('square')->fit(Manipulations::FIT_CROP, 400, 400); }); + $this->addMediaCollection('mailattachments'); } /** diff --git a/app/Form/Resources/FormResource.php b/app/Form/Resources/FormResource.php index ed556c23..f20f2727 100644 --- a/app/Form/Resources/FormResource.php +++ b/app/Form/Resources/FormResource.php @@ -80,6 +80,7 @@ class FormResource extends JsonResource 'mail_bottom' => null, 'config' => null, 'header_image' => null, + 'mailattachments' => [], 'id' => null, ], 'section_default' => [ diff --git a/packages/medialibrary-helper b/packages/medialibrary-helper index 91e5cc3e..3a7f5587 160000 --- a/packages/medialibrary-helper +++ b/packages/medialibrary-helper @@ -1 +1 @@ -Subproject commit 91e5cc3e3b6d7d0a8a3e2361514ec8c1ce9cb655 +Subproject commit 3a7f5587550f27864a14236f2ef9af77e947966c diff --git a/resources/js/app.js b/resources/js/app.js index e9f6d317..9996fb63 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -51,9 +51,13 @@ createInertiaApp({ requireModules(import.meta.glob('./components/ui/*.vue'), app, 'ui'); requireModules(import.meta.glob('./components/page/*.vue', {eager: true}), app, 'page'); app.component( - 'f-singlefile', + 'FSinglefile', defineAsyncComponent(() => import('!/medialibrary-helper/assets/components/SingleFile.vue')) ); + app.component( + 'FMultiplefiles', + defineAsyncComponent(() => import('!/medialibrary-helper/assets/components/MultipleFiles.vue')) + ); app.provide('axios', app.config.globalProperties.axios); app.mount(el); diff --git a/resources/js/views/form/Index.vue b/resources/js/views/form/Index.vue index 25a74a56..fe93f1c3 100644 --- a/resources/js/views/form/Index.vue +++ b/resources/js/views/form/Index.vue @@ -38,7 +38,7 @@
-
+
-
+
Sobald sich der erste Teilnehmer für die Veranstaltung angemeldet hat, kann dieses Formular nicht mehr geändert werden.
-
- +
+ Hier kannst du die E-Mail anpassen, die nach der Anmeldung an den Teilnehmer verschickt wird.
Es gibt dafür einen ersten E-Mail-Teil und einen zweiten E-Mail-Teil. Dazwischen werden die Daten des Teilnehmers aufgelistet.
- Die Anrede ("Hallo Max Mustermann") wird automatisch an den Anfang gesetzt.
+ Die Anrede ("Hallo Max Mustermann") wird automatisch an den Anfang gesetzt.
+ Außerdem kannst du Dateien hochladen, die automatisch mit angehangen werden. + +
diff --git a/tests/EndToEnd/Form/FormIndexActionTest.php b/tests/EndToEnd/Form/FormIndexActionTest.php index f7e06c89..f46b4a5f 100644 --- a/tests/EndToEnd/Form/FormIndexActionTest.php +++ b/tests/EndToEnd/Form/FormIndexActionTest.php @@ -55,6 +55,7 @@ class FormIndexActionTest extends FormTestCase ->assertInertiaPath('data.meta.default.name', '') ->assertInertiaPath('data.meta.default.description', []) ->assertInertiaPath('data.meta.default.excerpt', '') + ->assertInertiaPath('data.meta.default.mailattachments', []) ->assertInertiaPath('data.meta.default.config', null) ->assertInertiaPath('data.meta.base_url', url('')) ->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])