Add mailattachments upload field for forms
This commit is contained in:
parent
56e0223492
commit
e6261d42ff
|
@ -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'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,6 +80,7 @@ class FormResource extends JsonResource
|
|||
'mail_bottom' => null,
|
||||
'config' => null,
|
||||
'header_image' => null,
|
||||
'mailattachments' => [],
|
||||
'id' => null,
|
||||
],
|
||||
'section_default' => [
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 91e5cc3e3b6d7d0a8a3e2361514ec8c1ce9cb655
|
||||
Subproject commit 3a7f5587550f27864a14236f2ef9af77e947966c
|
|
@ -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);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<ui-popup v-if="single !== null && single.config !== null" :heading="`Veranstaltung ${single.id ? 'bearbeiten' : 'erstellen'}`" full @close="cancel">
|
||||
<div class="flex flex-col mt-3">
|
||||
<ui-tabs v-model="active" :entries="tabs"></ui-tabs>
|
||||
<div v-if="active === 0" class="grid grid-cols-2 gap-3">
|
||||
<div v-show="active === 0" class="grid grid-cols-2 gap-3">
|
||||
<f-text id="name" v-model="single.name" name="name" label="Name" required></f-text>
|
||||
<f-singlefile
|
||||
id="header_image"
|
||||
|
@ -63,17 +63,28 @@
|
|||
></f-textarea>
|
||||
<f-editor id="description" v-model="single.description" name="description" label="Beschreibung" rows="10" required></f-editor>
|
||||
</div>
|
||||
<div v-if="active === 1">
|
||||
<div v-show="active === 1">
|
||||
<ui-note class="mt-2"> Sobald sich der erste Teilnehmer für die Veranstaltung angemeldet hat, kann dieses Formular nicht mehr geändert werden. </ui-note>
|
||||
<form-builder v-model="single.config" :meta="meta"></form-builder>
|
||||
</div>
|
||||
<div v-if="active === 2" class="grid gap-3">
|
||||
<ui-note class="mt-2">
|
||||
<div v-show="active === 2" class="grid grid-cols-[1fr_300px] gap-3">
|
||||
<ui-note class="mt-2 col-span-full">
|
||||
Hier kannst du die E-Mail anpassen, die nach der Anmeldung an den Teilnehmer verschickt wird.<br />
|
||||
Es gibt dafür einen ersten E-Mail-Teil und einen zweiten E-Mail-Teil. Dazwischen werden die Daten des Teilnehmers aufgelistet.<br />
|
||||
Die Anrede ("Hallo Max Mustermann") wird automatisch an den Anfang gesetzt.</ui-note
|
||||
>
|
||||
Die Anrede ("Hallo Max Mustermann") wird automatisch an den Anfang gesetzt.<br />
|
||||
Außerdem kannst du Dateien hochladen, die automatisch mit angehangen werden.
|
||||
</ui-note>
|
||||
<f-textarea id="mail_top" v-model="single.mail_top" name="mail_top" label="E-Mail-Teil 1" rows="8" required></f-textarea>
|
||||
<f-multiplefiles
|
||||
id="mailattachments"
|
||||
v-model="single.mailattachments"
|
||||
label="Anhänge"
|
||||
name="mailattachments"
|
||||
parent-name="form"
|
||||
:parent-id="single.id"
|
||||
collection="mailattachments"
|
||||
class="row-span-2"
|
||||
></f-multiplefiles>
|
||||
<f-textarea id="mail_bottom" v-model="single.mail_bottom" name="mail_bottom" label="E-Mail-Teil 2" rows="8" required></f-textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue