Skip to content

Commit

Permalink
- wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EwelinaSkrzypacz committed Oct 22, 2024
1 parent 16e7a05 commit f561a25
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/DTOs/ContactFormResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function __construct(
public string $subject,
public string $response,
public string $messageDescription,
public string $locale,
) {}

public static function fromArray(ContactForm $record, array $data): self
Expand All @@ -20,6 +21,7 @@ public static function fromArray(ContactForm $record, array $data): self
subject: $data["responseTopic"],
response: $data["response"],
messageDescription: $record->message,
locale: $record->lang,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ protected function setUp(): void
->required(),
])
->action(function (ContactForm $record, array $data): void {
app()->setLocale($record->lang);

$details = ContactFormResponse::fromArray($record, $data);

Mail::to($record->email)->send(new ContactFormResponded($details));
Expand Down
3 changes: 2 additions & 1 deletion app/Mail/ContactFormResponded.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(
public function build(): self
{
return $this->subject($this->details->subject)
->view("email");
->view("email")
->with(["details" => $this->details]);
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ services:
- website-dev
- traefik-proxy-blumilk-local
ports:
- ${DOCKER_MAILPIT_DASHBOARD_HOST_PORT:-63854}:8025
- ${DOCKER_MAILPIT_DASHBOARD_HOST_PORT:-34622}:8025
restart: unless-stopped

redis:
Expand Down
10 changes: 10 additions & 0 deletions lang/en/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

return [
"subject" => "Response to contact form",
"header" => "Response from contact form",
"your_message" => "Your message",
"response" => "Response",
];
10 changes: 10 additions & 0 deletions lang/pl/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

return [
"subject" => "Odpowiedź na formularz kontaktowy",
"header" => "Odpowiedź z formularza kontaktowego",
"your_message" => "Twoja wiadomość",
"response" => "Odpowiedź",
];
10 changes: 5 additions & 5 deletions resources/views/email.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!doctype html>
<html lang="pl">
<html lang="{{ app()->getLocale() }}">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Odpowiedź na formularz kontaktowy</title>
<title>{{ __('email.subject') }}</title>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
Expand Down Expand Up @@ -157,17 +157,17 @@
<tr>
<td class="container">
<div class="content">
<h1>Odpowiedź z formularza kontaktowego</h1>
<h1>{{ __('email.header') }}</h1>
<table role="presentation" style="width: 100%;" class="main">
<tr>
<td class="wrapper">
<div class="message">
<h3>Twoja wiadomość</h3>
<h3>{{ __('email.your_message') }}</h3>
<div class="message-box">
<p>{!! $details->messageDescription !!}</p>
</div>
</div>
<h3>Odpowiedź</h3>
<h3>{{ __('email.response') }}</h3>
<div class="response-box">
{!! $details->response !!}
</div>
Expand Down

0 comments on commit f561a25

Please sign in to comment.