Mails
This commit is contained in:
parent
68b9d1ff88
commit
b9c26d06d0
75 changed files with 2143 additions and 818 deletions
68
app/Services/Placeholder.php
Normal file
68
app/Services/Placeholder.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Booking;
|
||||
|
||||
class Placeholder
|
||||
{
|
||||
|
||||
public static $booking = [
|
||||
'dear' => '#geehrte/r#',
|
||||
'salutation' => '#Anrede#',
|
||||
'title' => '#Titel#',
|
||||
'first_name' => '#Vorname#',
|
||||
'last_name' => '#Nachname#',
|
||||
'country' => '#Reiseland#',
|
||||
'program' => '#Programm#',
|
||||
'start_date' => '#Anreisedatum#',
|
||||
'end_date' => '#Abreisedatum#',
|
||||
'booking_date' => '#Buchungsdatum#',
|
||||
'airline' => '#Airline#'
|
||||
];
|
||||
|
||||
public static function getBookingQuill(){
|
||||
$ret = "";
|
||||
foreach (self::$booking as $key => $value) {
|
||||
$value = str_replace('#', '', $value);
|
||||
$ret .= "{id: '".$value."', label: '".$value."'},"."\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getBookingOptions(){
|
||||
$ret = "";
|
||||
foreach (self::$booking as $key => $value) {
|
||||
$value = str_replace('#', '', $value);
|
||||
$ret .= '<option value="'.$value.'">'.$value.'</option>'."\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function replaceBooking(Booking $booking, $content)
|
||||
{
|
||||
$dear = $booking->customer->salutation_id == 1 ? 'geehrter' : 'geehrte';
|
||||
$first_name = $booking->customer->firstname;
|
||||
$last_name = $booking->customer->name;
|
||||
$title = $booking->customer->title;
|
||||
$country = $booking->travel_country_id ? $booking->travel_country->name : "-";
|
||||
$program = $booking->travelagenda_id ? $booking->travel_agenda->name : "-";
|
||||
$salutation = $booking->customer->salutation->name;
|
||||
$start_date = $booking->getStartDateFormat();
|
||||
$end_date = $booking->getEndDateFormat();
|
||||
$booking_date = $booking->getBookingDateFormat();
|
||||
$airline = $booking->airline ? $booking->airline->name_full : '-';
|
||||
$search = [];
|
||||
$replace = [];
|
||||
|
||||
foreach (self::$booking as $key => $value) {
|
||||
$search[] = $value;
|
||||
$replace[] = ${$key};
|
||||
}
|
||||
$content = str_replace($search, $replace, $content);
|
||||
$content = preg_replace('/<placeholder.*?>(.*?)<\/placeholder>/', '$1', $content);
|
||||
$content = preg_replace('/<span contenteditable="false">(.*?)<\/span>/', '$1', $content);
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue