Mails etc. in Lead finish

This commit is contained in:
Kevin Adametz 2021-05-11 17:07:20 +02:00
parent 66ca252bfa
commit b362b93bca
45 changed files with 1460 additions and 418 deletions

View file

@ -3,6 +3,8 @@ namespace App\Services;
use App\Models\Booking;
use App\Models\TravelUserBookingFewo;
use App\Models\Lead;
class Placeholder
{
@ -29,6 +31,7 @@ class Placeholder
}
return $ret;
}
public static function getBookingOptions(){
$ret = "";
foreach (self::$booking as $key => $value) {
@ -90,6 +93,32 @@ class Placeholder
return $content;
}
public static function replaceLead(Lead $lead, $content)
{
$dear = $lead->customer->salutation_id == 1 ? 'geehrter' : 'geehrte';
$first_name = $lead->customer->firstname;
$last_name = $lead->customer->name;
$title = $lead->customer->title;
$country = "";
$program = "";
$salutation = $lead->customer->salutation_id == 1 ? 'Herr' : 'Frau';
$start_date = $lead->travelperiod_start ? _format_date($lead->travelperiod_start) : '';
$end_date = $lead->travelperiod_end ? _format_date($lead->travelperiod_end) : '';;
$booking_date = $lead->request_date ? _format_date($lead->request_date) : '';;
$airline = "";
$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;
}
}