Upload Files Booking, Mails, Attachments,

This commit is contained in:
Kevin Adametz 2020-04-17 15:51:22 +02:00
parent 5daea268f7
commit 68b9d1ff88
92 changed files with 2837 additions and 1778 deletions

View file

@ -6,6 +6,7 @@ namespace App\Repositories;
use App\Mail\MailSendInfo;
use App\Models\Airline;
use App\Models\Booking;
use App\Models\CMSContent;
use App\Models\CustomerFile;
use App\Models\CustomerMail;
use App\Services\Util;
@ -168,12 +169,12 @@ class CustomerMailRepository extends BaseRepository {
return true;
}
private function prepareContent($booking, $content){
$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;
@ -183,8 +184,8 @@ class CustomerMailRepository extends BaseRepository {
$airline = $booking->airline ? $booking->airline->name_full : '-';
$dear = $booking->customer->salutation_id == 1 ? 'geehrter' : 'geehrte';
$search = ['#geehrte/r#', '#Anrede#', '#Vorname#', '#Nachname#', '#Reiseland#', '#Programm#', '#Anreisedatum#', '#Abreisedatum#', '#Buchungsdatum#', '#Airline#'];
$replace = [$dear, $salutation, $first_name, $last_name, $country, $program, $start_date, $end_date, $booking_date, $airline];
$search = ['#geehrte/r#', '#Anrede#', '#Titel#', '#Vorname#', '#Nachname#', '#Reiseland#', '#Programm#', '#Anreisedatum#', '#Abreisedatum#', '#Buchungsdatum#', '#Airline#'];
$replace = [$dear, $salutation, $title, $first_name, $last_name, $country, $program, $start_date, $end_date, $booking_date, $airline];
$content = str_replace($search, $replace, $content);
return $content;
@ -287,19 +288,22 @@ class CustomerMailRepository extends BaseRepository {
if ($data['action'] === "new-customer-mail") {
$value->id = "";
$value->draft = false;
$lead_id = "-";
//singel
if (isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])) {
$value->id = $data['booking_id'];
$value->booking = $booking;
$value->show = 'single';
$value->draft = true;
$lead_id = " - (".$value->booking->lead_id.")";
}else{
//multi
$value->show = 'multi';
}
$value->customers = $data['customers'];
$value->subject = "";
$value->message = "<p>Sehr #geehrte/r# #Anrede# #Vorname# #Nachname#,</p><p>Text ...</p>";
$value->subject = $lead_id ;
$value->message = CMSContent::getContentBySlug('mailvorlage');
$value->s_placeholder = "Betreff der E-Mail";
$value->m_placeholder = "Nachricht der E-Mail";
if(isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])){