mirror of
https://github.com/anna-sara/vbytes_lan.git
synced 2026-09-03 10:25:22 +02:00
Possibility to set Mailtemplates to draft
This commit is contained in:
parent
c5bfb28eb8
commit
ee718a3a7d
4 changed files with 31 additions and 7 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Filament\Resources\Mailtemplates\Schemas;
|
|||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\MarkdownEditor;
|
||||
use DiscoveryDesign\FilamentGaze\Forms\Components\GazeBanner;
|
||||
|
|
@ -21,13 +22,13 @@ class MailtemplateForm
|
|||
TextInput::make('title')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('type')
|
||||
->label('Greeting')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
MarkdownEditor::make('content')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Toggle::make('draft')
|
||||
->default(false)
|
||||
->onColor('warning')
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class ParticipantsTable
|
|||
->schema([
|
||||
Select::make('mailtemplate')
|
||||
->label('Mailtemplate')
|
||||
->options(Mailtemplate::all()->pluck('title', 'id'))
|
||||
->options(Mailtemplate::where('draft', false)->pluck('title', 'id'))
|
||||
])
|
||||
->action(function (array $data, Participant $record) {
|
||||
$mailContent = Mailtemplate::where('id', $data['mailtemplate'])->get();
|
||||
|
|
@ -176,7 +176,7 @@ class ParticipantsTable
|
|||
->schema([
|
||||
Select::make('mailtemplate')
|
||||
->label('Mailtemplate')
|
||||
->options(Mailtemplate::all()->pluck('title', 'id'))
|
||||
->options(Mailtemplate::where('draft', false)->pluck('title', 'id'))
|
||||
])
|
||||
->action(function (array $data, Participant $record) {
|
||||
$mailContent = Mailtemplate::where('id', $data['mailtemplate'])->get();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class Mailtemplate extends Model
|
|||
protected $fillable = [
|
||||
'title',
|
||||
'content',
|
||||
'type'
|
||||
'type',
|
||||
'draft'
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('mailtemplates', function (Blueprint $table) {
|
||||
$table->boolean('draft')->default(false)->after('content');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mailtemplates', function (Blueprint $table) {
|
||||
$table->dropColumn('draft');
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue