Mehrere Tickets 49, 50, 51, 52, 53
This commit is contained in:
parent
ae70577289
commit
e3495be8b8
61 changed files with 1904 additions and 344 deletions
|
|
@ -98,4 +98,30 @@ class Booking
|
|||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function getBookingInstructionPDFName($fewo){
|
||||
return "HINWEISE-FERIENWOHNUNG-".$fewo->pdf_name.".pdf";
|
||||
}
|
||||
|
||||
public static function getBookingCMSContent($content, $identifier){
|
||||
return CMSContent::where('identifier', '=', $identifier)->where('integer', $content->id)->get()->sortBy('pos');
|
||||
}
|
||||
|
||||
public static function getBookingCMSContentForPDF($identifier_content, $identifier){
|
||||
$pdf_content = [];
|
||||
$contents = CMSContent::where('identifier', '=', $identifier_content)->get()->sortBy('pos');
|
||||
foreach ($contents as $content){
|
||||
if($content->decimal > 0){ //in_pdf
|
||||
$pdf_content[] = $content;
|
||||
}
|
||||
if($fewo_contents = self::getBookingCMSContent($content, $identifier)){
|
||||
foreach ($fewo_contents as $fewo_content){
|
||||
if($fewo_content->decimal > 0){ //in_pdf
|
||||
$pdf_content[] = $fewo_content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pdf_content;
|
||||
}
|
||||
}
|
||||
|
|
@ -232,6 +232,19 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCMSContentOptions($identifier, $setId = false, $empty=false){
|
||||
$options = CMSContent::where('identifier', '=', $identifier)->get()->sortBy('pos');
|
||||
$ret = "";
|
||||
if($empty){
|
||||
$ret = '<option value="0">Keine Vorlage</option>\n';
|
||||
}
|
||||
foreach ($options as $option){
|
||||
$attr = ($option->id === $setId) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getTravelClassOptions($programId = false, $setId = false){
|
||||
$options = TravelClass::where('program_id', $programId)->get();
|
||||
$ret = '<option value="">alle Kategorien</option>\n';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Services;
|
|||
use App\Models\Branch;
|
||||
use App\Models\Status;
|
||||
use App\Models\DraftType;
|
||||
use App\Models\CMSContent;
|
||||
use App\Models\Salutation;
|
||||
use App\Models\SfGuardUser;
|
||||
use App\Models\TravelAgenda;
|
||||
|
|
@ -90,9 +91,12 @@ class Model
|
|||
$DraftType = DraftType::where('active', true)->orderByDesc('pos')->get()->pluck('name', 'id');
|
||||
return $emtpy ? $DraftType->prepend('-', 0) : $DraftType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getCMSContentGeneralNameById($id = false){
|
||||
if($id > 0){
|
||||
$content = CMSContent::findOrFail($id);
|
||||
return $content->name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,17 @@ class Placeholder
|
|||
'end_date' => '#Abreisedatum#',
|
||||
'participants' => '#Teilnehmer#',
|
||||
'booking_date' => '#Buchungsdatum#',
|
||||
'airline' => '#Airline#'
|
||||
'airline' => '#Airline#',
|
||||
'extra_services' => '#zugebuchte_Leistungen#',
|
||||
'net_price_travel' => '#Nettopreise_Rundreise#',
|
||||
'net_price_extra_services' => '#Nettopreise_zugebuchte_Leistungen#',
|
||||
'booked_rooms' => '#Gebuchte_Zimmer#',
|
||||
'filekey' => "#Filekey#",
|
||||
'flight_info' => "#Airline_Fluginfo#",
|
||||
'check_in' => "#Airline_Checkin#",
|
||||
'baggage' => "#Airline_Gepaeck#",
|
||||
'country_visum' => '#Reiseland_Visum#',
|
||||
'country_contact' => '#Reiseland_Kontakt#',
|
||||
];
|
||||
|
||||
public static $placeholder_lead = [
|
||||
|
|
@ -112,10 +122,24 @@ class Placeholder
|
|||
$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 : '-';
|
||||
$filekey = $booking->filekey;
|
||||
|
||||
$flight_info = "";
|
||||
$check_in = "";
|
||||
$baggage = "";
|
||||
$country_visum = "";
|
||||
$country_contact = "";
|
||||
|
||||
$start_date = $booking->getStartDateFormat();
|
||||
$end_date = $booking->getEndDateFormat();
|
||||
$booking_date = $booking->getBookingDateFormat();
|
||||
$airline = $booking->airline ? $booking->airline->name_full : '-';
|
||||
|
||||
$extra_services = self::getBookingPlaceholdersBy('extra_services', $booking);
|
||||
$net_price_travel = self::getBookingPlaceholdersBy('net_price_travel', $booking);
|
||||
$net_price_extra_services = self::getBookingPlaceholdersBy('net_price_extra_services', $booking);
|
||||
$booked_rooms = self::getBookingPlaceholdersBy('booked_rooms', $booking);
|
||||
|
||||
$participants = "Teilnehmer:<br>";
|
||||
//first
|
||||
if($booking->participant_firstname){
|
||||
|
|
@ -140,8 +164,10 @@ class Placeholder
|
|||
$replace = [];
|
||||
|
||||
foreach (self::$placeholder_booking as $key => $value) {
|
||||
$search[] = $value;
|
||||
$replace[] = ${$key};
|
||||
if(isset(${$key})){
|
||||
$search[] = $value;
|
||||
$replace[] = ${$key};
|
||||
}
|
||||
}
|
||||
$content = str_replace($search, $replace, $content);
|
||||
$content = preg_replace('/<placeholder.*?>(.*?)<\/placeholder>/', '$1', $content);
|
||||
|
|
@ -209,4 +235,58 @@ class Placeholder
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static function getBookingPlaceholdersBy($key, $booking){
|
||||
|
||||
|
||||
if($booking->new_drafts){
|
||||
$booked_rooms = '';
|
||||
$extra_services = '';
|
||||
$net_price_travel = 0;
|
||||
$net_price_extra_services = 0;
|
||||
foreach($booking->booking_draft_items as $booking_draft_item){
|
||||
//41 zugebuchte Leistungen
|
||||
//32 Aufpreis Kategorie
|
||||
if(in_array($booking_draft_item->draft_type_id, [32, 41])){
|
||||
|
||||
}
|
||||
|
||||
//24 Rundreise
|
||||
if($booking_draft_item->draft_type_id == 24){
|
||||
|
||||
}
|
||||
|
||||
//30 Grundpreis Reise (Zimmer)
|
||||
if($booking_draft_item->draft_type_id == 30){
|
||||
$booked_rooms .= self::cleanText($booking_draft_item->service)." | ".$booking_draft_item->adult." Erw. ".($booking_draft_item->children ? " | ".$booking_draft_item->children." Kin." : '')."<br>";
|
||||
$prices = $booking_draft_item->getItemPrice();
|
||||
$net_price_travel += $prices['adult'];
|
||||
$net_price_travel += $prices['children'];
|
||||
|
||||
}
|
||||
}
|
||||
switch ($key) {
|
||||
case 'extra_services':
|
||||
return "zugebuchte Leistungen:<br>".$extra_services;
|
||||
break;
|
||||
case 'net_price_travel':
|
||||
return "Nettopreis Rundreise: ".Util::_number_format($net_price_travel)." Euro";
|
||||
break;
|
||||
case 'net_price_extra_services':
|
||||
return "Nettopreise zugebuchte Leistungen:<br>".$net_price_extra_services;
|
||||
break;
|
||||
case 'booked_rooms':
|
||||
return "Gebuchte Zimmer:<br>".$booked_rooms;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static function cleanText($text){
|
||||
$text = str_replace('pro Person im', '', $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue