Mails previews, Lead Passolution, Lead Country Files, LeadParticipant

This commit is contained in:
Kevin Adametz 2021-09-17 14:32:51 +02:00
parent 5e3bd3a1ba
commit ae70577289
28 changed files with 596 additions and 97 deletions

View file

@ -9,7 +9,7 @@ use App\Models\Lead;
class Placeholder
{
public static $booking = [
public static $placeholder_booking = [
'dear' => '#geehrte/r#',
'salutation' => '#Anrede#',
'title' => '#Titel#',
@ -24,9 +24,51 @@ class Placeholder
'airline' => '#Airline#'
];
public static function getBookingQuill(){
public static $placeholder_lead = [
'dear' => '#geehrte/r#',
'salutation' => '#Anrede#',
'title' => '#Titel#',
'first_name' => '#Vorname#',
'last_name' => '#Nachname#',
'country' => '#Reiseland#',
'program' => '#Programm#',
'start_date' => '#Anreisedatum#',
'end_date' => '#Abreisedatum#',
'participants' => '#Teilnehmer#',
'booking_date' => '#Buchungsdatum#',
];
public static $placeholder_fewo= [
'dear' => '#geehrte/r#',
'salutation' => '#Anrede#',
'title' => '#Titel#',
'first_name' => '#Vorname#',
'last_name' => '#Nachname#',
'program' => '#Programm#',
'start_date' => '#Anreisedatum#',
'end_date' => '#Abreisedatum#',
'booking_date' => '#Buchungsdatum#',
];
public static function getOptionsQuill($key){
$ret = "";
foreach (self::$booking as $key => $value) {
switch ($key) {
case 'booking':
$placehoder = self::$placeholder_booking;
break;
case 'lead':
$placehoder = self::$placeholder_lead;
break;
case 'fewo':
$placehoder = self::$placeholder_fewo;
break;
default:
$placehoder = self::$placeholder_booking;
break;
}
foreach ($placehoder as $key => $value) {
$value = str_replace('#', '', $value);
$ret .= "{id: '".$value."', label: '".$value."'},"."\n";
}
@ -35,12 +77,31 @@ class Placeholder
public static function getBookingOptions(){
$ret = "";
foreach (self::$booking as $key => $value) {
foreach (self::$placeholder_booking as $key => $value) {
$value = str_replace('#', '', $value);
$ret .= '<option value="'.$value.'">'.$value.'</option>'."\n";
}
return $ret;
}
public static function getLeadOptions(){
$ret = "";
foreach (self::$placeholder_lead as $key => $value) {
$value = str_replace('#', '', $value);
$ret .= '<option value="'.$value.'">'.$value.'</option>'."\n";
}
return $ret;
}
public static function getFewoOptions(){
$ret = "";
foreach (self::$placeholder_fewo as $key => $value) {
$value = str_replace('#', '', $value);
$ret .= '<option value="'.$value.'">'.$value.'</option>'."\n";
}
return $ret;
}
public static function replaceBooking(Booking $booking, $content)
{
@ -50,7 +111,7 @@ class Placeholder
$title = $booking->customer->title;
$country = $booking->travel_country_id ? $booking->travel_country->name : "-";
$program = $booking->travelagenda_id ? $booking->travel_agenda->name : "-";
$salutation = isset($booking->customer->salutation) ? $booking->customer->salutation->name : '';
$salutation = isset($booking->customer->salutation) ? $booking->customer->salutation->name : '-';
$start_date = $booking->getStartDateFormat();
$end_date = $booking->getEndDateFormat();
$booking_date = $booking->getBookingDateFormat();
@ -78,7 +139,7 @@ class Placeholder
$search = [];
$replace = [];
foreach (self::$booking as $key => $value) {
foreach (self::$placeholder_booking as $key => $value) {
$search[] = $value;
$replace[] = ${$key};
}
@ -94,18 +155,14 @@ class Placeholder
$first_name = $booking_fewo->travel_user->first_name;
$last_name = $booking_fewo->travel_user->last_name;
$title = $booking_fewo->travel_user->title;
$country = "";
$program = $booking_fewo->fewo_lodging_id ? $booking_fewo->fewo_lodging->name : "-";
$salutation = $booking_fewo->travel_user->salutation_id == 1 ? 'Herr' : 'Frau';
$start_date = $booking_fewo->from_date;
$end_date = $booking_fewo->to_date;
$booking_date = $booking_fewo->booking_date;
$participants = "";
$airline = "";
$search = [];
$replace = [];
foreach (self::$booking as $key => $value) {
foreach (self::$placeholder_fewo as $key => $value) {
$search[] = $value;
$replace[] = ${$key};
}
@ -121,14 +178,13 @@ class Placeholder
$first_name = $lead->customer->firstname;
$last_name = $lead->customer->name;
$title = $lead->customer->title;
$country = "";
$program = "";
$country = $lead->travelcountry_id ? $lead->travel_country->name : "-";
$program = $lead->travelagenda_id ? $lead->travel_agenda->name : "-";
$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) : '';
$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) : '-';
$participants = "";
$airline = "";
if($lead->lead_participants->count()){
$participants = "Teilnehmer:<br>";
foreach($lead->lead_participants as $participant){
@ -140,12 +196,9 @@ class Placeholder
$participants .= '<br>';
}
}
$search = [];
$replace = [];
foreach (self::$booking as $key => $value) {
foreach (self::$placeholder_lead as $key => $value) {
$search[] = $value;
$replace[] = ${$key};
}