From 242649aa9ee75cedf53da24df693d795c65481a0 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 19 Sep 2024 12:40:11 +0300 Subject: [PATCH] update --- .../Email/App/Filament/Pages/SendEmail.php | 73 +++++++++++++++++++ .../filament/pages/email-settings.blade.php | 2 +- .../views/filament/pages/send-email.blade.php | 22 ++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 web/Modules/Email/App/Filament/Pages/SendEmail.php create mode 100644 web/Modules/Email/resources/views/filament/pages/send-email.blade.php diff --git a/web/Modules/Email/App/Filament/Pages/SendEmail.php b/web/Modules/Email/App/Filament/Pages/SendEmail.php new file mode 100644 index 0000000..e6ecf3c --- /dev/null +++ b/web/Modules/Email/App/Filament/Pages/SendEmail.php @@ -0,0 +1,73 @@ +from = 'admin@'; + + return $form + ->schema([ + TextInput::make('from') + ->disabled() + ->columnSpanFull(), + TextInput::make('to') + ->label('To') + ->required() + ->columnSpanFull(), + TextInput::make('subject') + ->label('Subject') + ->required() + ->columnSpanFull(), + Textarea::make('body') + ->rows(10) + ->label('Body') + ->required() + ->columnSpanFull(), + ]); + } + + public function send() + { + if (mail($this->to, $this->subject, $this->body)) { + // Trigger a success notification + Notification::make() + ->title('Email Sent') + ->body('The email has been sent successfully.') + ->send(); + $this->to = ''; + } else { + // Trigger an error notification + Notification::make() + ->title('Email Not Sent') + ->body('The email could not be sent.') + ->send(); + } + } +} diff --git a/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php b/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php index 04575b5..b0eb2e2 100644 --- a/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php +++ b/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php @@ -1,6 +1,6 @@ -
+
Email settings
diff --git a/web/Modules/Email/resources/views/filament/pages/send-email.blade.php b/web/Modules/Email/resources/views/filament/pages/send-email.blade.php new file mode 100644 index 0000000..9c73569 --- /dev/null +++ b/web/Modules/Email/resources/views/filament/pages/send-email.blade.php @@ -0,0 +1,22 @@ + + +
+
+ +
+ {{ $this->form }} +
+ + + Send + Sending... + +
+ + +
+ +