From 76c4670f09432857b30abf1ab7f842b3a449677d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Azad=20Furkan=20=C5=9EAKAR?= Date: Mon, 7 Oct 2024 16:20:54 +0300 Subject: [PATCH] wip --- resources/lang/en/form-maker.php | 167 ++++++++++++++++++ resources/lang/tr/form-maker.php | 83 ++++++++- src/Enums/FieldTypes.php | 16 +- src/Enums/FormStatus.php | 4 +- src/Filament/Forms/FormPicker.php | 1 - .../FormBuilderCollectionResource.php | 24 +-- .../Resources/FormBuilderDataResource.php | 41 +++-- src/Livewire/FormBuilder.php | 2 +- src/Models/Traits/HasHiddenOptions.php | 1 + src/Models/Traits/HasOptions.php | 37 ++-- src/Models/Traits/SubmitAction.php | 16 +- 11 files changed, 324 insertions(+), 68 deletions(-) diff --git a/resources/lang/en/form-maker.php b/resources/lang/en/form-maker.php index f9576fb..2cc1ef1 100644 --- a/resources/lang/en/form-maker.php +++ b/resources/lang/en/form-maker.php @@ -6,16 +6,183 @@ 'resources' => [ 'builder' => [ + 'section_title' => 'Form Information', 'model_label' => 'Form Builder', 'plural_model_label' => 'Form Builders', + 'inputs' => [ + 'name' => 'Name', + ], + 'options' => [ + 'title' => 'Form Settings', + 'description' => 'More Form Settings', + 'notification_name' => 'Notification Name', + 'background_color' => 'Background Color', + 'mail_notifications' => 'Mail Notifications', + 'user_emails' => 'Notification Emails', + 'user_emails_hint' => 'Select the users you want to send the form to after it is submitted.', + 'static_fields' => [ + 'full_span' => 'Full Width', + 'placeholder' => 'Placeholder', + 'notification_name' => 'Notification Name', + 'is_required' => 'Required Field', + 'hidden_label' => 'Hidden Label', + 'field_id' => 'Field ID', + 'html_id' => 'HTML ID', + 'column_span' => 'Column Width', + 'helper_text' => 'Helper Text', + ], + 'notifications' => [ + 'label' => 'Successful Notification Settings', + 'title' => 'Title', + 'body' => 'Body', + ], + 'select_field' => [ + 'title' => 'Select Box Settings', + 'is_multiple' => 'Multiple Selection', + 'is_searchable' => 'Searchable', + 'data_source' => 'Data Source', + ], + 'checkbox_radio_field' => [ + 'title' => 'Checkbox / Radio Button Settings', + 'data_source' => 'Data Source', + 'one_column' => 'One Column', + 'two_columns' => 'Two Columns', + 'three_columns' => 'Three Columns', + 'four_columns' => 'Four Columns', + ], + 'text_field' => [ + 'title' => 'Text Field Settings', + 'field_type' => 'Field Type', + 'types' => [ + 'text' => 'Text', + 'email' => 'Email', + 'url' => 'URL', + 'number' => 'Number', + ], + 'max_value' => 'Maximum Value', + 'min_value' => 'Minimum Value', + ], + 'file_field' => [ + 'title' => 'File Field Settings', + 'max_size' => 'Maximum File Size', + 'hint' => 'In KB', + 'accepted_file_types' => 'Accepted Extensions', + 'image' => 'Image', + ], + 'visibility' => [ + 'title' => 'Conditional Visibility', + 'active' => 'Conditional Visibility Active', + 'fieldId' => 'Field to Bind Condition', + 'values' => 'Visibility Value', + 'values_helper_text' => 'Leave this field empty if you want it to be visible when any value is selected.', + ], + ], + 'sections' => [ + 'title' => 'Sections', + 'count' => 'Section Count', + 'add_action_label' => 'Add Section', + 'new_section_label' => 'New Section', + 'inputs' => [ + 'title' => 'Title', + 'columns' => 'Column Count', + 'columns_hint' => 'Number of columns in the section', + ], + ], + 'fields' => [ + 'title' => 'Fields', + 'add_action_label' => 'Add Field', + 'new_field_label' => 'New Field', + 'options' => [ + 'title' => 'Field Settings', + 'description' => 'More Field Settings', + ], + 'inputs' => [ + 'name' => 'Field Name', + 'type' => 'Field Type', + ], + ], ], 'collections' => [ 'model_label' => 'Form Collection', 'plural_model_label' => 'Form Collections', + 'inputs' => [ + 'name' => 'Name', + 'type' => 'Type', + 'type_options' => [ + 'list' => 'List', + 'model' => 'Model', + ], + 'values' => [ + 'title' => 'Values', + 'label' => 'Label', + 'value' => 'Value', + 'add_value' => 'Add Value', + ], + ], ], 'form_data' => [ 'model_label' => 'Form Data', 'plural_model_label' => 'Form Data', + 'inputs' => [ + 'name' => 'Form Name', + 'status' => 'Status', + 'ip_address' => 'IP Address', + 'user_agent' => 'Browser Info', + 'file' => [ + 'label' => 'File', + 'download' => 'Download File', + ], + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + ], + 'section_title' => 'Form Information', + 'actions' => [ + 'open' => [ + 'label' => 'Reopen', + 'modal' => [ + 'title' => 'Reopen Form', + 'body' => 'Are you sure you want to reopen the form?', + 'success' => 'Form successfully reopened.', + ], + ], + 'close' => [ + 'label' => 'Close', + 'modal' => [ + 'title' => 'Close Form', + 'body' => 'Are you sure you want to close the form?', + 'success' => 'Form successfully closed.', + ], + ], + ], + ], + ], + + 'notification' => [ + 'toast' => [ + 'title' => 'Operation Successful', + 'body' => 'Your message has been sent. We will contact you as soon as possible.', + ], + 'mail' => [ + 'title' => 'New Notification - :form_name', + 'greeting' => 'Hello!', + 'view' => 'View', + ], + ], + + 'enums' => [ + 'field_types' => [ + 'text' => 'Text', + 'phone' => 'Phone', + 'textarea' => 'Text Area', + 'select' => 'Select Box', + 'file' => 'File', + 'date' => 'Date', + 'checkbox' => 'Checkbox', + 'radio' => 'Radio Button', + ], + 'form_status' => [ + 'closed' => 'Closed', + 'open' => 'Open', ], ], ]; diff --git a/resources/lang/tr/form-maker.php b/resources/lang/tr/form-maker.php index 9d2f343..4a24b95 100644 --- a/resources/lang/tr/form-maker.php +++ b/resources/lang/tr/form-maker.php @@ -18,8 +18,8 @@ 'notification_name' => 'Bildirim Adı', 'background_color' => 'Arka Plan Rengi', 'mail_notifications' => 'Mail Bildirimleri', - 'user_emails' => 'Kullanıcı E-postaları', - 'user_emails_hint' => 'Forum\'un doldurulduktan sonra iletilmesini istediğiniz kullanıcıları seçiniz.', + 'user_emails' => 'Bildirim E-postaları', + 'user_emails_hint' => 'Formun doldurulduktan sonra iletilmesini istediğiniz kullanıcıları seçiniz.', 'static_fields' => [ 'full_span' => 'Tam Genişlik', 'placeholder' => 'Placeholder', @@ -31,6 +31,11 @@ 'column_span' => 'Sütun Genişliği', 'helper_text' => 'Yardımcı Metin', ], + 'notifications' => [ + 'label' => 'Başarılı Bildirim Ayarları', + 'title' => 'Başlık', + 'body' => 'Metin', + ], 'select_field' => [ 'title' => 'Seçim Kutusu Ayarları', 'is_multiple' => 'Çoklu Seçim', @@ -100,10 +105,84 @@ 'collections' => [ 'model_label' => 'Form Koleksiyonu', 'plural_model_label' => 'Form Koleksiyonları', + 'inputs' => [ + 'name' => 'Adı', + 'type' => 'Tipi', + 'type_options' => [ + 'list' => 'Liste', + 'model' => 'Model', + ], + 'values' => [ + 'title' => 'Değerler', + 'label' => 'Etiket', + 'value' => 'Değer', + 'add_value' => 'Değer Ekle', + ], + ], ], 'form_data' => [ 'model_label' => 'Form Verileri', 'plural_model_label' => 'Form Verileri', + 'inputs' => [ + 'name' => 'Form Adı', + 'status' => 'Durum', + 'ip_address' => 'IP Adresi', + 'user_agent' => 'Tarayıcı Bilgisi', + 'file' => [ + 'label' => 'Dosya', + 'download' => 'Dosyayı İndir', + ], + 'created_at' => 'Oluşturulma Tarihi', + 'updated_at' => 'Güncellenme Tarihi', + ], + 'section_title' => 'Form Bilgileri', + 'actions' => [ + 'open' => [ + 'label' => 'Yeniden Aç', + 'modal' => [ + 'title' => 'Formu Yeniden Aç', + 'body' => 'Formu yeniden açmak istediğinize emin misiniz?', + 'success' => 'Form başarıyla yeniden açıldı.', + ], + ], + 'close' => [ + 'label' => 'Kapat', + 'modal' => [ + 'title' => 'Formu Kapat', + 'body' => 'Formu kapatmak istediğinize emin misiniz?', + 'success' => 'Form başarıyla kapatıldı.', + ], + ], + ], + ], + ], + + 'notification' => [ + 'toast' => [ + 'title' => 'İşlem Başarılı', + 'body' => 'Mesajınız gönderildi. En kısa sürede sizinle iletişime geçeceğiz.', + ], + 'mail' => [ + 'title' => 'Yeni Bildirim - :form_name', + 'greeting' => 'Merhaba!', + 'view' => 'Görüntüle', + ], + ], + + 'enums' => [ + 'field_types' => [ + 'text' => 'Metin', + 'phone' => 'Telefon', + 'textarea' => 'Metin Alanı', + 'select' => 'Seçim Kutusu', + 'file' => 'Dosya', + 'date' => 'Tarih', + 'checkbox' => 'Onay Kutusu', + 'radio' => 'Seçim Düğmesi', + ], + 'form_status' => [ + 'closed' => 'Kapatıldı', + 'open' => 'Açık', ], ], ]; diff --git a/src/Enums/FieldTypes.php b/src/Enums/FieldTypes.php index 26b63fe..9ba9c4f 100644 --- a/src/Enums/FieldTypes.php +++ b/src/Enums/FieldTypes.php @@ -16,14 +16,14 @@ enum FieldTypes: string public function label(): string { return match ($this) { - self::TEXT => 'Metin', - self::PHONE => 'Telefon', - self::TEXTAREA => 'Uzun Metin', - self::SELECT => 'Seçim Kutusu', - self::FILE => 'Dosya', - self::DATE => 'Tarih', - self::CHECKBOX => 'Onay Kutusu', - self::RADIO => 'Seçim Düğmesi', + self::TEXT => trans('filament-form-maker::form-maker.enums.field_types.text'), + self::PHONE => trans('filament-form-maker::form-maker.enums.field_types.phone'), + self::TEXTAREA => trans('filament-form-maker::form-maker.enums.field_types.textarea'), + self::SELECT => trans('filament-form-maker::form-maker.enums.field_types.select'), + self::FILE => trans('filament-form-maker::form-maker.enums.field_types.file'), + self::DATE => trans('filament-form-maker::form-maker.enums.field_types.date'), + self::CHECKBOX => trans('filament-form-maker::form-maker.enums.field_types.checkbox'), + self::RADIO => trans('filament-form-maker::form-maker.enums.field_types.radio'), }; } diff --git a/src/Enums/FormStatus.php b/src/Enums/FormStatus.php index af9e69b..5ac5f23 100644 --- a/src/Enums/FormStatus.php +++ b/src/Enums/FormStatus.php @@ -10,8 +10,8 @@ enum FormStatus: string public function label(): string { return match ($this) { - self::CLOSED => 'Kapatıldı', - self::OPEN => 'Açık', + self::CLOSED => trans('filament-form-maker::form-maker.enums.form_status.closed'), + self::OPEN => trans('filament-form-maker::form-maker.enums.form_status.open'), }; } diff --git a/src/Filament/Forms/FormPicker.php b/src/Filament/Forms/FormPicker.php index eb83cc7..5f4d8ac 100644 --- a/src/Filament/Forms/FormPicker.php +++ b/src/Filament/Forms/FormPicker.php @@ -11,7 +11,6 @@ protected function setUp(): void { parent::setUp(); - $this->native(false); $this->searchable(); $this->preload(); $this->options(fn () => FormBuilder::pluck('name', 'id')->toArray()); diff --git a/src/Filament/Resources/FormBuilderCollectionResource.php b/src/Filament/Resources/FormBuilderCollectionResource.php index da44c76..ee987b4 100644 --- a/src/Filament/Resources/FormBuilderCollectionResource.php +++ b/src/Filament/Resources/FormBuilderCollectionResource.php @@ -49,20 +49,20 @@ public static function form(Form $form): Form Forms\Components\Section::make() ->schema([ Forms\Components\TextInput::make('name') - ->label('Adı') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.name')) ->required(), Forms\Components\ToggleButtons::make('type') - ->label('Tipi') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type')) ->live() ->inline() ->options([ - 'list' => 'Liste', - 'model' => 'Model', + 'list' => trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.list'), + 'model' => trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.model'), ]) ->default('list') ->required(), Forms\Components\Select::make('model') - ->label('Model') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type_options.model')) ->visible(fn ($get) => $get('type') === 'model') ->native(false) ->preload() @@ -76,16 +76,16 @@ public static function form(Form $form): Form }) ->required(), Forms\Components\Repeater::make('values') - ->label('Değerler') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.title')) ->visible(fn ($get) => $get('type') === 'list') - ->addActionLabel('Değer Ekle') + ->addActionLabel(trans('filament-form-maker::form-maker.resources.collections.inputs.values.add_value')) ->grid(3) ->schema([ Forms\Components\TextInput::make('label') - ->label('Etiket') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.label')) ->required(), Forms\Components\TextInput::make('value') - ->label('Değer') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.values.value')) ->required(), ]), ]), @@ -98,14 +98,14 @@ public static function table(Table $table): Table ->columns([ Tables\Columns\TextColumn::make('name') ->searchable() - ->label('Adı'), + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.name')), Tables\Columns\TextColumn::make('type') - ->label('Tipi') + ->label(trans('filament-form-maker::form-maker.resources.collections.inputs.type')) ->badge() ->color('info') ->formatStateUsing(function ($state, $record) { return match ($state) { - default => 'Liste', + default => trans('filament-form-maker::form-maker.resources.collections.inputs.type'), 'model' => (new $record->model)->getClassName(), }; }), diff --git a/src/Filament/Resources/FormBuilderDataResource.php b/src/Filament/Resources/FormBuilderDataResource.php index 9884405..30dedb1 100644 --- a/src/Filament/Resources/FormBuilderDataResource.php +++ b/src/Filament/Resources/FormBuilderDataResource.php @@ -76,38 +76,38 @@ public static function infolist(Infolist $infolist): Infolist ->columns(2) ->schema([ TextEntry::make('name') - ->label('Form Adı'), + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.name')), TextEntry::make('status') - ->label('Durum') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.status')) ->badge() ->formatStateUsing(fn ($state) => $state?->label()) ->color(fn ($state) => $state?->color()), TextEntry::make('ip') - ->label('IP Adresi'), + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.ip_address')), TextEntry::make('url') ->label('URL'), TextEntry::make('user_agent') ->columnSpanFull() - ->label('Tarayıcı Bilgisi'), + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.user_agent')), TextEntry::make('file') - ->label('Dosya') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.file.label')) ->columnSpanFull() ->visible(fn ($record) => $record->getFirstMedia('file')) ->default(function ($record) { $cv = $record->getFirstMedia('file') ? $record->getFirstMediaUrl('file') : null; - return new HtmlString("Dosyayı İndir"); + return new HtmlString("" . trans('filament-form-maker::form-maker.resources.form_data.inputs.file.download') . ''); }), ]), Tabs::make() ->schema([ - Tabs\Tab::make('Genel Bilgiler') + Tabs\Tab::make(trans('filament-form-maker::form-maker.resources.form_data.section_title')) ->columns(2) ->statePath('fields') ->schema( @@ -140,7 +140,7 @@ public static function table(Table $table): Table Tables\Columns\TextColumn::make('name') ->badge() - ->label('Form Adı') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.name')) ->searchable() ->sortable(), @@ -148,33 +148,32 @@ public static function table(Table $table): Table ->badge() ->formatStateUsing(fn ($state) => $state?->label()) ->color(fn ($state) => $state?->color()) - ->label('Durum') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.status')) ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() - ->label('Oluşturulma Tarihi') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.created_at')) ->sortable(), Tables\Columns\TextColumn::make('updated_at') ->dateTime() - ->label('Değiştirme Tarihi') + ->label(trans('filament-form-maker::form-maker.resources.form_data.inputs.updated_at')) ->sortable(), ]) ->filters([ // ]) ->actions([ - Tables\Actions\ViewAction::make() - ->modalHeading('Görüntüle'), + Tables\Actions\ViewAction::make(), Tables\Actions\Action::make('close') - ->label('Kapat') + ->label(trans('filament-form-maker::form-maker.resources.form_data.actions.close.label')) ->color('success') ->icon('heroicon-o-x-circle') ->requiresConfirmation() - ->modalHeading('Formu Kapat') - ->modalDescription('Bu formu kapatmak istediğinize emin misiniz?') - ->successNotificationTitle('Form başarıyla kapatıldı.') + ->modalHeading(trans('filament-form-maker::form-maker.resources.form_data.actions.close.modal.title')) + ->modalDescription(trans('filament-form-maker::form-maker.resources.form_data.actions.close.modal.body')) + ->successNotificationTitle(trans('filament-form-maker::form-maker.resources.form_data.actions.close.modal.success')) ->action(function ($record, $action) { $record->update(['status' => 'closed']); @@ -182,12 +181,12 @@ public static function table(Table $table): Table })->visible(fn ($record) => $record->status === FormStatus::OPEN), Tables\Actions\Action::make('open') ->color('danger') - ->label('Yeniden Aç') + ->label(trans('filament-form-maker::form-maker.resources.form_data.actions.open.label')) ->icon('heroicon-o-check-circle') ->requiresConfirmation() - ->modalHeading('Formu Yeniden Aç') - ->modalDescription('Bu formu yeniden açmak istediğinize emin misiniz?') - ->successNotificationTitle('Form başarıyla yeniden açıldı.') + ->modalHeading(trans('filament-form-maker::form-maker.resources.form_data.actions.open.modal.title')) + ->modalDescription(trans('filament-form-maker::form-maker.resources.form_data.actions.open.modal.body')) + ->successNotificationTitle(trans('filament-form-maker::form-maker.resources.form_data.actions.open.modal.success')) ->action(function ($record, $action) { $record->update(['status' => 'open']); diff --git a/src/Livewire/FormBuilder.php b/src/Livewire/FormBuilder.php index c7b6a9c..3cfaed8 100644 --- a/src/Livewire/FormBuilder.php +++ b/src/Livewire/FormBuilder.php @@ -59,7 +59,7 @@ public function save() 'admin_ids' => data_get($this->options, 'admin_ids') ?? [], ]; - $this->submit($data); + $this->submit($data, $this->options); $this->form->fill(); // @phpstan-ignore-line } diff --git a/src/Models/Traits/HasHiddenOptions.php b/src/Models/Traits/HasHiddenOptions.php index c2d578d..3ee9eb1 100644 --- a/src/Models/Traits/HasHiddenOptions.php +++ b/src/Models/Traits/HasHiddenOptions.php @@ -34,6 +34,7 @@ protected static function hiddenFieldLabels(): Forms\Components\Group Forms\Components\Hidden::make('column_span')->default(1), Forms\Components\Hidden::make('data_source'), Forms\Components\Hidden::make('helper_text')->default(null), + Forms\Components\Hidden::make('notifications')->default([]), ]) ->columns(1); } diff --git a/src/Models/Traits/HasOptions.php b/src/Models/Traits/HasOptions.php index 9424727..a469c96 100644 --- a/src/Models/Traits/HasOptions.php +++ b/src/Models/Traits/HasOptions.php @@ -19,7 +19,9 @@ protected static function staticFieldOptions(?int $columns): Forms\Components\Gr $colspanOptions = []; foreach (range(1, $columns) as $column) { - $colspanOptions[$column] = $column . '/' . $columns; + if ($column !== $columns) { + $colspanOptions[$column] = $column . '/' . $columns; + } } $colspanOptions['full'] = trans('filament-form-maker::form-maker.resources.builder.options.static_fields.full_span'); @@ -72,20 +74,29 @@ protected static function staticFormBuilderOptions(): Forms\Components\Group Forms\Components\ColorPicker::make('background_color') ->label(trans('filament-form-maker::form-maker.resources.builder.options.background_color')) ->default('transparent'), - Forms\Components\Section::make(trans('filament-form-maker::form-maker.resources.builder.options.mail_notifications')) - ->schema([ - Forms\Components\Select::make('admin_ids') - ->label(trans('filament-form-maker::form-maker.resources.builder.options.user_emails')) - ->hintIcon('tabler-info-circle', trans('filament-form-maker::form-maker.resources.builder.options.user_emails_hint')) - ->native(false) - ->searchable() - ->options(function () { - $userModel = Filament::auth()->getProvider()->getModel(); // @phpstan-ignore-line + Forms\Components\Select::make('admin_ids') + ->label(trans('filament-form-maker::form-maker.resources.builder.options.user_emails')) + ->hintIcon('tabler-info-circle', trans('filament-form-maker::form-maker.resources.builder.options.user_emails_hint')) + ->native(false) + ->searchable() + ->options(function () { + $userModel = Filament::auth()->getProvider()->getModel(); // @phpstan-ignore-line - return $userModel::all()->pluck('name', 'id')->toArray(); - }) - ->multiple() + return $userModel::all()->pluck('name', 'id')->toArray(); + }) + ->multiple() + ->nullable(), + Forms\Components\Section::make(trans('filament-form-maker::form-maker.resources.builder.options.notifications.label')) + ->collapsed() + ->statePath('notifications') + ->schema([ + Forms\Components\TextInput::make('title') + ->label(trans('filament-form-maker::form-maker.resources.builder.options.notifications.title')) ->nullable(), + Forms\Components\Textarea::make('body') + ->label(trans('filament-form-maker::form-maker.resources.builder.options.notifications.body')) + ->nullable(), + ]), ]); } diff --git a/src/Models/Traits/SubmitAction.php b/src/Models/Traits/SubmitAction.php index dd8292e..4c1aa5e 100644 --- a/src/Models/Traits/SubmitAction.php +++ b/src/Models/Traits/SubmitAction.php @@ -14,7 +14,7 @@ trait SubmitAction { - public function submit($data) + public function submit($data, $options = []): void { $fields = self::manipulateFields($data['fields']); @@ -53,15 +53,15 @@ public function submit($data) $messageNotification = MessageNotification::make( (new MailMessage) - ->subject('Yeni Bildirim - ' . $form_name) - ->greeting('Merhaba!') + ->subject(trans('filament-form-maker::form-maker.notification.mail.title', ['form_name' => $form_name])) + ->greeting(trans('filament-form-maker::form-maker.notification.mail.greeting')) ->lines($lines) - ->action('Görüntüle', FormBuilderDataResource::getUrl('view', ['record' => $form])), + ->action(trans('filament-form-maker::form-maker.notification.mail.view'), FormBuilderDataResource::getUrl('view', ['record' => $form])), Notification::make() - ->title('Yeni Bildirim - ' . $form_name) + ->title(trans('filament-form-maker::form-maker.notification.mail.title', ['form_name' => $form_name])) ->actions([ Action::make('view') - ->label('Görüntüle') + ->label(trans('filament-form-maker::form-maker.notification.mail.view')) ->url(FormBuilderDataResource::getUrl('view', ['record' => $form])), ]) ); @@ -71,8 +71,8 @@ public function submit($data) $userModel::notification($messageNotification, data_get($data, 'admin_ids', [])); Notification::make() - ->title('Form Submitted') - ->body('Your message has been sent. We will contact you as soon as possible.') + ->title(data_get($options, 'notifications.title') ?? trans('filament-form-maker::form-maker.notification.toast.title')) + ->body(data_get($options, 'notifications.body') ?? trans('filament-form-maker::form-maker.notification.toast.body')) ->send(); }