Fewo Mails / Booking Country Services

This commit is contained in:
Kevin Adametz 2020-05-28 19:03:42 +02:00
parent b9c26d06d0
commit 48a6eb2282
154 changed files with 7761 additions and 1643 deletions

View file

@ -1,15 +1,17 @@
<?php
namespace App\Services;
use App\Models\Airline;
use App\Models\CMSAuthor;
use App\Models\CMSContent;
use App\Models\Country;
use App\Models\Draft;
use App\Models\DraftType;
use App\Models\FewoLodging;
use App\Models\IndustrySector;
use App\Models\Interest;
use App\Models\Insurance;
use App\Models\TravelBookingFewoChannel;
use App\Models\TravelClass;
use App\Models\TravelCompany;
use App\Models\TravelCountry;
use App\Models\TravelGuide;
use App\Models\TravelNationality;
@ -250,9 +252,14 @@ class HTMLHelper
return $ret;
}
public static function getTravelUserOptions($id = false, $order = "ASC"){
public static function getTravelUserOptions($id = false, $order = "ASC", $empty=false){
$options = TravelUser::orderBy('id', $order)->get();
$ret = '';
if($empty){
$ret = '<option value="">Bitte wählen</option>\n';
}
foreach ($options as $option){
$attr = ($option->id === $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->first_name.' '.$option->last_name.' | '.$option->email.' ('.$option->id.')</option>\n';
@ -260,6 +267,33 @@ class HTMLHelper
return $ret;
}
public static function getCustomerMailDirsOptions(CMSContent $customer_mail_dir, $checked = []){
//$checked = [];
$model = $customer_mail_dir->getArrayContent('model');
switch ($model){
case 'TravelCountry':
$options = \App\Models\Sym\TravelCountry::where('active_backend',1)->get();
break;
case 'Airline':
$options = Airline::where('name_full', 'like', '%Xemail%')->get();
break;
case 'Insurance':
$options = Insurance::where('active',1)->get();
break;
case 'TravelCompany':
$options = TravelCompany::where('active',1)->get();
break;
default:
return '';
}
$ret = '';
foreach ($options as $option){
$attr = (in_array($option->id, $checked)) ? 'selected="selected"' : '';
$ret .= '<option value="'.$option->id.'" '.$attr.'>'.$option->name.'</option>\n';
}
return $ret;
}
public static function getFewoLodgingOptions($id = false){
$options = FewoLodging::all();
$ret = '';