Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:40:14 +02:00
parent 881fc84207
commit 4eb83def39
142 changed files with 21396 additions and 11243 deletions

View file

@ -58,7 +58,7 @@ class ReportFewoController extends Controller
}
if(Request::get('filter_date_to') != ""){
$date_to = Carbon::parse(Request::get('filter_date_to'))->format("Y-m-d");
$query->where("to_date", '<=', $date_to);
$query->where("from_date", '<=', $date_to);
}
if(Request::get('filter_booking_date_from') != ""){

View file

@ -36,20 +36,19 @@ class AdminUserController extends Controller
];
$user = User::findOrFail(8);
/* $MyGoogle2FA = new MyGoogle2FA();
/* $MyGoogle2FA = new MyGoogle2FA();
$valid = $MyGoogle2FA->init($user)->check2Fa('676493');
dd($valid); */
dd($valid); */
return view('admin.users', $data);
}
public function edit($id)
{
if($id == "new"){
if ($id == "new") {
$user = new User();
}else{
} else {
$user = User::findOrFail($id);
}
/*if(!$user->account){
$user->account = new Account();
@ -60,21 +59,19 @@ class AdminUserController extends Controller
'isFromAdmin' => 'true',
];
return view('admin.user_edit', $data);
}
public function store()
{
$data = Request::all();
if($data['user_id'] === "new"){
if ($data['user_id'] === "new") {
$rules = array(
'name' => 'required',
'email' => 'required|string|email|max:255|unique:users',
'email-confirm' => 'required|same:email',
);
}else{
} else {
$rules = array(
'name' => 'required'
);
@ -84,27 +81,24 @@ class AdminUserController extends Controller
return back()->withRequest(Request::all())->withErrors($validator);
}
if($data['user_id'] === "new"){
if ($data['user_id'] === "new") {
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => env('APP_KEY'),
]);
$unique = false;
do{
do {
$confirmation_code = str_random(30);
if( User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
if (User::where('confirmation_code', '=', $confirmation_code)->count() == 0) {
$unique = true;
}
}
while(!$unique);
} while (!$unique);
$user->confirmation_code = $confirmation_code;
$user->save();
Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user));
}else{
} else {
$user = User::findOrFail($data['user_id']);
$user->name = $data['name'];
$user->save();
@ -121,54 +115,54 @@ class AdminUserController extends Controller
\Session()->flash('alert-success', "Kontakt gelöscht");
return redirect('/admin/users');
}
public function loadModal($id){
public function loadModal($id)
{
if(Request::ajax()) {
if (Request::ajax()) {
$data = Request::all();
$user = User::findOrFail($id);
if(isset($data['action'])){
if($data['action'] === 'show-user-roles'){
if (isset($data['action'])) {
if ($data['action'] === 'show-user-roles') {
$fill = [
'user' => $user,
'action' => $data['action'],
'groups' => config('permissions.groups'),
'roles' => config('permissions.roles')
];
return view("admin.user_modal", $fill )->render();
return view("admin.user_modal", $fill)->render();
}
if($data['action'] === 'show-user-active'){
if ($data['action'] === 'show-user-active') {
$fill = [
'user' => $user,
'action' => $data['action'],
];
return view("admin.active_modal", $fill )->render();
return view("admin.active_modal", $fill)->render();
}
if($data['action'] === 'show-user-google2fa'){
if($user->isGoogle2Fa()){
if ($data['action'] === 'show-user-google2fa') {
if ($user->isGoogle2Fa()) {
$MyGoogle2FA = new MyGoogle2FA();
$MyGoogle2FA->init($user);
$MyGoogle2FA->init($user);
$fill = [
'user' => $user,
'action' => 'delete-user-google2fa',
'MyGoogle2FA' => $MyGoogle2FA,
];
return view("admin.google2fa_delete_modal", $fill )->render();
}else{
return view("admin.google2fa_delete_modal", $fill)->render();
} else {
$MyGoogle2FA = new MyGoogle2FA();
$MyGoogle2FA->init($user)->generate();
$MyGoogle2FA->init($user)->generate();
$fill = [
'user' => $user,
'action' => 'activate-user-google2fa',
'MyGoogle2FA' => $MyGoogle2FA,
];
return view("admin.google2fa_modal", $fill )->render();
return view("admin.google2fa_modal", $fill)->render();
}
}
}
@ -176,9 +170,10 @@ class AdminUserController extends Controller
return false;
}
public function updateModal($action = false){
public function updateModal($action = false)
{
if($action=== 'show-user-roles'){
if ($action === 'show-user-roles') {
$data = Request::all();
$user = User::findOrFail($data['id']);
$user->permissions = isset($data['permissions']) ? $data['permissions'] : [];
@ -187,17 +182,15 @@ class AdminUserController extends Controller
$user->active = isset($data['active']) ? true : false;
$user->save();
\Session()->flash('alert-save', true);
}
if($action=== 'show-user-active'){
if ($action === 'show-user-active') {
$data = Request::all();
$user = User::findOrFail($data['id']);
$user->active = isset($data['active']) ? true : false;
$user->save();
\Session()->flash('alert-save', true);
}
if($action=== 'activate-user-google2fa'){
if ($action === 'activate-user-google2fa') {
$data = Request::all();
$user = User::findOrFail($data['id']);
$user->google2fa = true;
@ -205,7 +198,7 @@ class AdminUserController extends Controller
\Session()->flash('alert-save', true);
}
if($action=== 'delete-user-google2fa'){
if ($action === 'delete-user-google2fa') {
$data = Request::all();
$user = User::findOrFail($data['id']);
$user->google2fa = false;
@ -228,23 +221,22 @@ class AdminUserController extends Controller
return '<a href="' . route('admin_user_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('admin', function (User $user) {
return '<a href="#" data-url="'.route('admin_user_load_modal', $user->id).'" data-data="'.$user->id.'" data-action="show-user-roles" class="update_modal_data_show">'.HTMLHelper::getRoleLabel($user->admin, '<i class="fa fa-edit"></i> Rechte + ','').'</a>';
return '<a href="#" data-url="' . route('admin_user_load_modal', $user->id) . '" data-data="' . $user->id . '" data-action="show-user-roles" class="update_modal_data_show">' . HTMLHelper::getRoleLabel($user->admin, '<i class="fa fa-edit"></i> Rechte + ', '') . '</a>';
})
->addColumn('google2fa', function (User $user) {
$icon = $user->google2fa ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-times-circle"></i>';
$color = $user->google2fa ? 'primary' : 'danger';
return ' <a href="#" data-url="'.route('admin_user_load_modal', $user->id).'" data-data="'.$user->id.'" data-action="show-user-google2fa" class="update_modal_data_show btn btn-sm btn-'.$color.'">'.$icon.' google2fa</a>';
return ' <a href="#" data-url="' . route('admin_user_load_modal', $user->id) . '" data-data="' . $user->id . '" data-action="show-user-google2fa" class="update_modal_data_show btn btn-sm btn-' . $color . '">' . $icon . ' google2fa</a>';
})
->addColumn('confirmed', function (User $user) {
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
})
->addColumn('active', function (User $user) {
$active = $user->active ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
return ' <a href="#" data-url="'.route('admin_user_load_modal', $user->id).'" data-data="'.$user->id.'" data-action="show-user-active" class="update_modal_data_show">'.$active.'</a>';
return ' <a href="#" data-url="' . route('admin_user_load_modal', $user->id) . '" data-data="' . $user->id . '" data-action="show-user-active" class="update_modal_data_show">' . $active . '</a>';
})
->addColumn('action_delete', function (User $user) {
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\'' . __('Really delete entry?') . '\');"><span class="fa fa-trash"></span></a>';
})
->orderColumn('confirmed', 'confirmed $1')
->orderColumn('active', 'active $1')
@ -252,8 +244,4 @@ class AdminUserController extends Controller
->rawColumns(['action_edit', 'admin', 'confirmed', 'active', 'action_delete', 'google2fa'])
->make(true);
}
}
}

View file

@ -0,0 +1,124 @@
<?php
namespace App\Http\Controllers\CMS;
use App\Http\Controllers\Controller;
use App\Models\News;
use App\Models\Page;
use Carbon\Carbon;
use IqContent\LaravelFilemanager\Lfm;
use Request;
class CMSNewsController extends Controller
{
/*
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware(['admin', '2fa']);
}
public function index()
{
$data = [
'news' => News::all(),//News::where('lvl', 1)->get(),
];
return view('cms.news.index', $data);
}
public function detail($id)
{
if($id === "new") {
$news = new News();
$id = 'new';
$news->status = 1;
$news->content_new = "";
}else{
$news = News::findOrFail($id);
$id = $news->id;
}
$data = [
'news' => $news,
'id' => $id,
'lfm_helper' => app(Lfm::class),
];
return view('cms.news.detail', $data);
}
public function store($id)
{
$data = Request::all();
if($id === "new") {
$news = new News();
$news->model = 'news';
$news->owner_second = 0;
$news->show_in_navi = 1;
$news->catalog_id = 1;
}else{
$news = News::findOrFail($id);
}
$news->title = $data['title'];
$news->status = isset($data['status']) ? true : false;
$news->slug = $data['slug'];
$news->date = $data['date'];
$news->content_new = $data['content_new'];
$news->box_body = $data['image'];
$news->description = $data['description'];
$news->pagetitle = $data['pagetitle'];
$news->keywords = $data['keywords'];
$news->order = (new Carbon($news->date))->format('Ymd')*-1;
$root_news = News::where('cms_settings', 'news_root')->first();
if($id != $root_news->id){
//root ID = 3126
$news->lvl = 1;
$news->owner = $root_news->id;
$news->parent_id = $root_news->id;
$news->tree_root = $root_news->id;
if($first_news = $root_news->children->first()){
$news->lft = $first_news->lft;
$news->rgt = $first_news->rgt;
}else{
$news->lft = $root_news->lft +1;
$news->rgt = $root_news->lft +2;
}
}
$news->save();
\Session()->flash('alert-save', '1');
return redirect(route('cms_news_detail', [$news->id]));
}
public function delete($id){
$news = News::findOrFail($id);
//TODO
//check for delete, only delete lvl 2 .,...?
if ($news->lvl != 1){
abort(404);
die();
}
$news->delete();
\Session()->flash('alert-success', __('News gelöscht'));
return redirect(route('cms_news'));
}
}

View file

@ -1,31 +0,0 @@
<?php
namespace App\Http\Controllers\IQ;
use App\Http\Controllers\Controller;
use Request;
use IqContent\LaravelFilemanager\Controllers\LfmController;
class ContentAssetController extends LfmController
{
public function index()
{
$data = [
'models' => [],
'lfm_helper' => $this->helper,
'modal' => false,
];
return view('iq.content.assets.index', $data);
}
public function modal(){
$data = [
'models' => [],
'lfm_helper' => $this->helper,
'modal' => true,
];
return view('iq.content.assets.body', $data);
}
}

View file

@ -22,13 +22,23 @@ class RequestController extends Controller
public function __construct()
{
$this->middleware(['admin', '2fa']);
$this->middleware(['admin', '2fa']);
}
public function index($step = false)
{
// Get distinct travel_country_ids from bookings that are not null
$usedCountryIds = Booking::whereNotNull('travel_country_id')
->distinct()
->pluck('travel_country_id');
// Fetch the corresponding TravelCountry models and create an associative array [id => name]
$travel_countries = TravelCountry::whereIn('id', $usedCountryIds)
->pluck('name', 'id') // Use country id as key
->toArray();
//dd($travel_countries); // Keep this for debugging if needed
$travel_countries = Booking::join('travel_country', 'travel_country_id', '=', 'travel_country.id')->get()->pluck('name', 'travel_country_id')->unique()->toArray();
$filter_lead_status = Status::get()->pluck('name', 'id')->toArray();
$filter_travel_company = TravelCompany::get()->pluck('name', 'id')->toArray();
$filter_airports = Airport::get()->pluck('name', 'id')->toArray();
@ -61,6 +71,7 @@ class RequestController extends Controller
'filter_sf_guard_user' => $filter_sf_guard_user,
'filter_airports' => $filter_airports,
];
return view('request.index', $data);
}
@ -87,60 +98,62 @@ class RequestController extends Controller
}
die();
*/
private function getSearchRequests(){
private function getSearchRequests()
{
$query = Booking::with('lead')->with('customer')->with('customer_mails')->with('customer_mails')->select('booking.*')->where('lead_id', '!=', NULL);
if(Request::get('full_firstname_search') != ""){
if (Request::get('full_firstname_search') != "") {
$query->whereHas('customer', function ($q) {
$q->where('firstname', 'LIKE', '%'.Request::get('full_firstname_search').'%');
}); }
if(Request::get('full_lastname_search') != ""){
$query->whereHas('customer', function ($q) {
$q->where('name', 'LIKE', '%'.Request::get('full_lastname_search').'%');
$q->where('firstname', 'LIKE', '%' . Request::get('full_firstname_search') . '%');
});
}
if(Request::get('travel_option_country_id') != ""){
$country_ids = TravelCountry::where('contact_lands', 'LIKE', '%"'.Request::get('travel_option_country_id').'"%')->get()->pluck('id');
if (Request::get('full_lastname_search') != "") {
$query->whereHas('customer', function ($q) {
$q->where('name', 'LIKE', '%' . Request::get('full_lastname_search') . '%');
});
}
if (Request::get('travel_option_country_id') != "") {
$country_ids = TravelCountry::where('contact_lands', 'LIKE', '%"' . Request::get('travel_option_country_id') . '"%')->get()->pluck('id');
$country_ids[] = Request::get('travel_option_country_id');
$query->whereIn('travel_country_id', $country_ids);
}
if(Request::get('travel_option_agenda_id') != ""){
if (Request::get('travel_option_agenda_id') != "") {
$query->where('travelagenda_id', '=', Request::get('travel_option_agenda_id'));
}
if(Request::get('travel_option_company_id') != ""){
if (Request::get('travel_option_company_id') != "") {
$query->where('travel_company_id', '=', Request::get('travel_option_company_id'));
}
if(Request::get('travel_option_lead_status_id') != ""){
if (Request::get('travel_option_lead_status_id') != "") {
$query->whereHas('lead', function ($q) {
$q->whereIn('status_id', Request::get('travel_option_lead_status_id'));
});
}
if(Request::get('travel_option_paying_out') != ""){
if (Request::get('travel_option_paying_out') != "") {
$query->where('paying_out', '=', Request::get('travel_option_paying_out'));
}
if(Request::get('travel_option_paying_out_status') != ""){
if (Request::get('travel_option_paying_out_status') != "") {
$query->where('paying_out_status', '=', Request::get('travel_option_paying_out_status'));
}
if(Request::get('travel_option_refund') != ""){
if (Request::get('travel_option_refund') != "") {
$query->where('refund', '=', Request::get('travel_option_refund'));
}
if(Request::get('travel_option_xx_tkt') != ""){
if (Request::get('travel_option_xx_tkt') != "") {
$query->where('xx_tkt', '=', Request::get('travel_option_xx_tkt'));
}
if(Request::get('travel_option_airline_id') != ""){
$query->where('airline_ids', 'LIKE', '%'.Request::get('travel_option_airline_id').'%');
if (Request::get('travel_option_airline_id') != "") {
$query->where('airline_ids', 'LIKE', '%' . Request::get('travel_option_airline_id') . '%');
}
if(Request::get('travel_option_airport_id') != ""){
if (Request::get('travel_option_airport_id') != "") {
$query->where('airport_id', '=', Request::get('travel_option_airport_id'));
}
// $query->where('end_date', '<=', $now);
if(Request::get('travel_option_search')){
if (Request::get('travel_option_search')) {
$now = Carbon::now();
switch (Request::get('travel_option_search')){
switch (Request::get('travel_option_search')) {
case 'before_2':
$query->whereBetween('start_date', [Carbon::now()->modify('-2 month'), $now]);
@ -162,245 +175,245 @@ class RequestController extends Controller
break;
}
}else{
} else {
$start = null;
$end = null;
if(Request::get('arrival_start_date') != ""){
if (Request::get('arrival_start_date') != "") {
$arrStart = explode(".", Request::get('arrival_start_date'));
if(count($arrStart) == 3){
if (count($arrStart) == 3) {
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
}
}
if(Request::get('arrival_end_date') != ""){
if (Request::get('arrival_end_date') != "") {
$arrEnd = explode(".", Request::get('arrival_end_date'));
if(count($arrEnd) == 3){
if (count($arrEnd) == 3) {
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
}
}
if($start && $end){
if ($start && $end) {
$query->whereBetween('start_date', [$start, $end]);
}
if($start && !$end){
if ($start && !$end) {
$query->where('start_date', '>=', $start);
}
if(!$start && $end){
if (!$start && $end) {
$query->where('start_date', '<=', $end);
}
$start = null;
$end = null;
if(Request::get('departure_start_date') != ""){
if (Request::get('departure_start_date') != "") {
$arrStart = explode(".", Request::get('departure_start_date'));
if(count($arrStart) == 3){
if (count($arrStart) == 3) {
$start = Carbon::create($arrStart[2], $arrStart[1], $arrStart[0], 0, 0, 0);
}
}
if(Request::get('departure_end_date') != ""){
if (Request::get('departure_end_date') != "") {
$arrEnd = explode(".", Request::get('departure_end_date'));
if(count($arrEnd) == 3){
if (count($arrEnd) == 3) {
$end = Carbon::create($arrEnd[2], $arrEnd[1], $arrEnd[0], 23, 59, 59);
}
}
if($start && $end){
if ($start && $end) {
$query->whereBetween('end_date', [$start, $end]);
}
if($start && !$end){
if ($start && !$end) {
$query->where('end_date', '>=', $start);
}
if(!$start && $end){
if (!$start && $end) {
$query->where('end_date', '<=', $end);
}
}
if(Request::get('sort_travel_country_id') != ""){
if (Request::get('sort_travel_country_id') != "") {
$query->where('travel_country_id', '=', Request::get('sort_travel_country_id'));
}
if(Request::get('sort_travelagenda_id') != ""){
if (Request::get('sort_travelagenda_id') != "") {
$query->where('travelagenda_id', '=', Request::get('sort_travelagenda_id'));
}
if(Request::get('sort_sf_guard_user_id') != ""){
if (Request::get('sort_sf_guard_user_id') != "") {
$query->where('sf_guard_user_id', '=', Request::get('sort_sf_guard_user_id'));
}
if(Request::get('sort_travel_documents') != ""){
if (Request::get('sort_travel_documents') != "") {
$query->where('travel_documents', '=', Request::get('sort_travel_documents'));
}
if(Request::get('full_lead_id_search') != ""){
$query->where('lead_id', 'LIKE', '%'.Request::get('full_lead_id_search'). '%');
if (Request::get('full_lead_id_search') != "") {
$query->where('lead_id', 'LIKE', '%' . Request::get('full_lead_id_search') . '%');
}
if(Request::get('full_booking_id_search') != ""){
$query->where('id', 'LIKE', '%'.Request::get('full_booking_id_search').'%');
if (Request::get('full_booking_id_search') != "") {
$query->where('id', 'LIKE', '%' . Request::get('full_booking_id_search') . '%');
}
return $query;
}
public function getAjaxRequests(){
public function getAjaxRequests()
{
$data = Request::all();
if(Request::ajax()) {
if(isset($data['action']) && $data['action'] === "get_popover_booking_services") {
if (Request::ajax()) {
if (isset($data['action']) && $data['action'] === "get_popover_booking_services") {
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
$count = false;
foreach($booking->travel_country->getContactLandsModels() as $TravelCountry){
if($TravelCountry->stern_travel_country){
$hl = $TravelCountry->stern_travel_country->name."<br>";
foreach ($booking->travel_country->getContactLandsModels() as $TravelCountry) {
if ($TravelCountry->stern_travel_country) {
$hl = $TravelCountry->stern_travel_country->name . "<br>";
$tmp = "";
foreach($TravelCountry->stern_travel_country->travel_country_services as $travel_country_service){
foreach ($TravelCountry->stern_travel_country->travel_country_services as $travel_country_service) {
$tmp .= \App\Models\BookingCountryService::getStatus($travel_country_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$travel_country_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$travel_country_service->name.'</span>';
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> ' . $travel_country_service->name . '</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> ' . $travel_country_service->name . '</span>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
if ($tmp !== "") {
$ret .= $hl . $tmp;
}
}
}
if($booking->service_provider_entries->count()){
foreach($booking->service_provider_entries as $service_provider_entry){
if($service_provider_entry->service_provider->service_provider_services->count()){
$hl = $service_provider_entry->service_provider->name."<br>";
if ($booking->service_provider_entries->count()) {
foreach ($booking->service_provider_entries as $service_provider_entry) {
if ($service_provider_entry->service_provider->service_provider_services->count()) {
$hl = $service_provider_entry->service_provider->name . "<br>";
$tmp = "";
foreach($service_provider_entry->service_provider->service_provider_services as $service_provider_service){
foreach ($service_provider_entry->service_provider->service_provider_services as $service_provider_service) {
$tmp .= \App\Models\BookingProviderService::getStatus($service_provider_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$service_provider_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$service_provider_service->name.'</span>';
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> ' . $service_provider_service->name . '</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> ' . $service_provider_service->name . '</span>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
if ($tmp !== "") {
$ret .= $hl . $tmp;
}
}
}
}
if($booking->booking_service_items->count()){
foreach($booking->booking_service_items as $booking_service_item){
if($booking_service_item->travel_company->travel_company_services->count()){
$hl = $booking_service_item->travel_company->name."<br>";
if ($booking->booking_service_items->count()) {
foreach ($booking->booking_service_items as $booking_service_item) {
if ($booking_service_item->travel_company->travel_company_services->count()) {
$hl = $booking_service_item->travel_company->name . "<br>";
$tmp = "";
foreach($booking_service_item->travel_company->travel_company_services as $travel_company_service){
foreach ($booking_service_item->travel_company->travel_company_services as $travel_company_service) {
$tmp .= \App\Models\BookingCompanyService::getStatus($travel_company_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$travel_company_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$travel_company_service->name.'</span>';
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> ' . $travel_company_service->name . '</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> ' . $travel_company_service->name . '</span>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
if ($tmp !== "") {
$ret .= $hl . $tmp;
}
}
}
}
return $ret === "" ? 'keine Leistungen definiert' : $ret;
return $ret === "" ? 'keine Leistungen definiert' : $ret;
}
if(isset($data['action']) && $data['action'] === "get_popover_booking_notice"){
if (isset($data['action']) && $data['action'] === "get_popover_booking_notice") {
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
if($booking->booking_notices->count()){
if ($booking->booking_notices->count()) {
$booking_notice = $booking->booking_notices->first();
return $booking_notice->getSmallerMessage(500);
}
return $ret === "" ? 'keine E-Notiz' : $ret;
return $ret === "" ? 'keine E-Notiz' : $ret;
}
if(isset($data['action']) && $data['action'] === "get_popover_booking_last_email"){
if (isset($data['action']) && $data['action'] === "get_popover_booking_last_email") {
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
if($booking->customer_mails->count()){
if ($booking->customer_mails->count()) {
$customer_mail = $booking->customer_mails_sent_at->last();
return "<h6>".$customer_mail->subject."</h6>".$customer_mail->message;
}
return $ret === "" ? 'keine E-Mail' : $ret;
return "<h6>" . $customer_mail->subject . "</h6>" . $customer_mail->message;
}
return $ret === "" ? 'keine E-Mail' : $ret;
}
if(isset($data['action']) && $data['action'] === "get_popover_booking_participants_pass"){
if (isset($data['action']) && $data['action'] === "get_popover_booking_participants_pass") {
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
if($booking->participant_firstname){
$ret .= $booking->participant_pass ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$booking->participant_firstname." ".$booking->participant_lastname.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$booking->participant_firstname." ".$booking->participant_lastname.'</span>';
$ret .= "<br>";
if ($booking->participant_firstname) {
$ret .= $booking->participant_pass ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> ' . $booking->participant_firstname . " " . $booking->participant_lastname . '</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> ' . $booking->participant_firstname . " " . $booking->participant_lastname . '</span>';
$ret .= "<br>";
}
if($booking->participants->count()){
foreach($booking->participants as $participant){
if ($booking->participants->count()) {
foreach ($booking->participants as $participant) {
$ret .= $participant->participant_pass ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$participant->participant_firstname." ".$participant->participant_lastname.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$participant->participant_firstname." ".$participant->participant_lastname.'</span>';
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> ' . $participant->participant_firstname . " " . $participant->participant_lastname . '</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> ' . $participant->participant_firstname . " " . $participant->participant_lastname . '</span>';
$ret .= "<br>";
}
}
return $ret === "" ? 'keine Teilnehmer' : $ret;
}
$query = $this->getSearchRequests();
$ret = $query->get()->pluck('travelagenda_id', 'id')->unique()->toArray();
return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
}
}
public function loadModal(){
public function loadModal()
{
$data = Request::all();
$ret = "";
if(Request::ajax()){
if($data['action'] === 'new-customer-mail'){
if (Request::ajax()) {
if ($data['action'] === 'new-customer-mail') {
$data['customers'] = [];
$query = $this->getSearchRequests();
$bookings = $query->orderBy('id', 'DESC')->limit(50)->get();
foreach ($bookings as $booking){
foreach ($bookings as $booking) {
$tmp = [];
$tmp['email'] = $booking->customer ? $booking->customer->email : "";
$tmp['name'] = $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
$tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
$tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
$tmp['name'] = $booking->customer ? $booking->customer->firstname . " " . $booking->customer->name . " | " : "- | ";
$tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name . " | " : "- | ";
$tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name . "" : "-";
$data['customers'][$booking->id] = $tmp;
}
$ret = CustomerMailRepository::loadModal($data);
}
if($data['action'] === 'show-customer-mail'){
if ($data['action'] === 'show-customer-mail') {
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
if($booking->customer_mails->count()){
if ($booking->customer_mails->count()) {
$ret = CustomerMailRepository::loadModal($data);
}
}
}
}
return response()->json(['response' => $data, 'html'=>$ret]);
return response()->json(['response' => $data, 'html' => $ret]);
}
public function getRequests()
{
$query = $this->getSearchRequests();
return DataTables::eloquent($query)
->addColumn('action_booking_edit', function (Booking $booking) {
return '<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('action_booking_edit', function (Booking $booking) {
return '<a href="' . route('booking_detail', [$booking->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('id', function (Booking $booking) {
return '<a data-order="'.$booking->id.'" href="'.make_old_url('booking/'.$booking->id.'/edit').'" data-id="'.$booking->id.'">'.$booking->id.'</a>';
return '<a data-order="' . $booking->id . '" href="' . make_old_url('booking/' . $booking->id . '/edit') . '" data-id="' . $booking->id . '">' . $booking->id . '</a>';
})
->addColumn('action_lead_edit', function (Booking $booking) {
return '<a href="' . route('lead_detail', [$booking->lead_id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('lead_id', function (Booking $booking) {
return '<a data-order="'.$booking->lead_id.'" href="'.make_old_url('leads/'.$booking->lead_id.'/edit').'" data-id="'.$booking->lead_id.'">'.$booking->lead_id.'</a>';
return '<a data-order="' . $booking->lead_id . '" href="' . make_old_url('leads/' . $booking->lead_id . '/edit') . '" data-id="' . $booking->lead_id . '">' . $booking->lead_id . '</a>';
})
->addColumn('travel_country_id', function (Booking $booking) {
return '<span data-order="'.($booking->travel_country_id ? $booking->travel_country_id : 0).'">'.($booking->travel_country_id ? $booking->travel_country->name : "-").'</span>';
return '<span data-order="' . ($booking->travel_country_id ? $booking->travel_country_id : 0) . '">' . ($booking->travel_country_id ? $booking->travel_country->name : "-") . '</span>';
})
->addColumn('travelagenda_id', function (Booking $booking) {
return '<span data-order="'.($booking->travelagenda_id ? $booking->travelagenda_id : 0).'">'.($booking->travelagenda_id ? $booking->travel_agenda->name : "-").'</span>';
return '<span data-order="' . ($booking->travelagenda_id ? $booking->travelagenda_id : 0) . '">' . ($booking->travelagenda_id ? $booking->travel_agenda->name : "-") . '</span>';
})
->addColumn('travel_company_id', function (Booking $booking) {
return '<span data-order="'.($booking->travel_company_id ? $booking->travel_company_id : 0).'">'.($booking->travel_company ? $booking->travel_company->name : "-").'</span>';
return '<span data-order="' . ($booking->travel_company_id ? $booking->travel_company_id : 0) . '">' . ($booking->travel_company ? $booking->travel_company->name : "-") . '</span>';
})
->addColumn('airport_id', function (Booking $booking) {
return '<span data-order="'.($booking->airport_id ? $booking->airport_id : 0).'">'.($booking->airport ? $booking->airport->name : "-").'</span>';
return '<span data-order="' . ($booking->airport_id ? $booking->airport_id : 0) . '">' . ($booking->airport ? $booking->airport->name : "-") . '</span>';
})
->addColumn('comfort', function (Booking $booking) {
return $booking->comfort ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
@ -415,92 +428,94 @@ class RequestController extends Controller
return $booking->travel_documents ? '<span data-order="1" class="badge badge-pill badge-success" title="Reiseunterlagen vollständig" data-placement="top" rel="tooltip"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger" title="Reiseunterlagen nicht vollständig" data-placement="top" rel="tooltip"><i class="fa fa-times"></i></span>';
})
->addColumn('booking_services', function (Booking $booking) {
return $booking->hasBookingServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_services" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_services" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-times"></i></span>';
return $booking->hasBookingServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="' . $booking->id . '" data-action="get_popover_booking_services" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="' . $booking->id . '" data-action="get_popover_booking_services" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-times"></i></span>';
})
->addColumn('booking_notice', function (Booking $booking) {
return $booking->booking_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_notice" data-placement="top" data-toggle="popover" title="letzte Notiz"><i class="fa fa-check"></i></span>' :
return $booking->booking_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="' . $booking->id . '" data-action="get_popover_booking_notice" data-placement="top" data-toggle="popover" title="letzte Notiz"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" title="keine Notiz" data-placement="top" rel="tooltip"><i class="fa fa-times"></i></span>';
})
->addColumn('sf_guard_user_id', function (Booking $booking) {
return '<span data-order="'.($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0).'">'.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").'</span>';
return '<span data-order="' . ($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0) . '">' . ($booking->sf_guard_user_id ? $booking->sf_guard_user->first_name . " " . $booking->sf_guard_user->last_name : "-") . '</span>';
})
->addColumn('lead.status_id', function (Booking $booking) {
if($booking->lead){
if ($booking->lead) {
return $booking->lead->getStatusBadge($booking);
}
return '<span data-order="0">-</span>';
})
->addColumn('last_customer_email', function (Booking $booking) {
if($booking->customer_mails->count()){
$customer_mail = $booking->customer_mails_sent_at->last();
$badge = $customer_mail->is_answer ? 'badge-default' : 'badge-secondary';
$badge = !$customer_mail->send ? $badge : 'badge-success';
return '<a data-order="'.$customer_mail->getSentAtRaw().'" href="#" data-toggle="modal"
if ($booking->customer_mails->count()) {
$customer_mail = $booking->customer_mails_sent_at->last();
$badge = $customer_mail->is_answer ? 'badge-default' : 'badge-secondary';
$badge = !$customer_mail->send ? $badge : 'badge-success';
return '<a data-order="' . $customer_mail->getSentAtRaw() . '" href="#" data-toggle="modal"
data-target="#modals-load-content"
data-id="show-mail"
data-url="mail"
data-preview="true"
data-booking_id="'.$booking->id.'"
data-customer_mail_id="'.$customer_mail->id.'"
data-booking_id="' . $booking->id . '"
data-customer_mail_id="' . $customer_mail->id . '"
data-action="show-customer-mail"
data-redirect="back"
data-route="'.route('requests_modal_load').'">
<span class="badge '.$badge.'">'
.($customer_mail->send ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-times-circle"></i>').' '
.$customer_mail->sent_at.'</span>
data-route="' . route('requests_modal_load') . '">
<span class="badge ' . $badge . '">'
. ($customer_mail->send ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-times-circle"></i>') . ' '
. $customer_mail->sent_at . '</span>
</a>';
}
return '<span data-order="">-</span>';
})
->addColumn('booking_participants_pass', function (Booking $booking) {
return $booking->hasBookingParticipantsPass() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_participants_pass" data-placement="top" data-toggle="popover" title="Teilnehmer Pass"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_participants_pass" data-placement="top" data-toggle="popover" title="Teilnehmer Pass"><i class="fa fa-times"></i></span>';
return $booking->hasBookingParticipantsPass() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="' . $booking->id . '" data-action="get_popover_booking_participants_pass" data-placement="top" data-toggle="popover" title="Teilnehmer Pass"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="' . $booking->id . '" data-action="get_popover_booking_participants_pass" data-placement="top" data-toggle="popover" title="Teilnehmer Pass"><i class="fa fa-times"></i></span>';
})
->addColumn('paying_out', function (Booking $booking) {
$icon = "";
$badge = $booking->getPayingOutColor();
if($booking->paying_out_status == 1){ //offen
if ($booking->paying_out_status == 1) { //offen
$icon = '<i class="fa fa-times-circle"></i> ';
}
if($booking->paying_out_status == 2){ //erledigt
if ($booking->paying_out_status == 2) { //erledigt
$badge = 'success';
$icon = '<i class="fa fa-check-circle"></i> ';
}
return '<span data-order="'.$booking->paying_out.'"><span class="badge badge-'.$booking->getPayingOutColor().'">'.$icon.$booking->getPayingOutType().'</span></span>';
return '<span data-order="' . $booking->paying_out . '"><span class="badge badge-' . $booking->getPayingOutColor() . '">' . $icon . $booking->getPayingOutType() . '</span></span>';
})
->addColumn('paying_out_status', function (Booking $booking) {
return '<span data-order="'.$booking->paying_out_status.'"><span class="badge badge-'.$booking->getPayingOutStatusColor().'">'.$booking->getPayingOutStatusType().'</span></span>';
return '<span data-order="' . $booking->paying_out_status . '"><span class="badge badge-' . $booking->getPayingOutStatusColor() . '">' . $booking->getPayingOutStatusType() . '</span></span>';
})
->addColumn('airline_ids', function (Booking $booking) {
return $booking->airline_ids ? '<span data-order="'.$booking->getAirlinesIDs().'">'. $booking->getAirlinesAsNames().'</span>' : '-';
return $booking->airline_ids ? '<span data-order="' . $booking->getAirlinesIDs() . '">' . $booking->getAirlinesAsNames() . '</span>' : '-';
})
->addColumn('refund', function (Booking $booking) {
return '<span data-order="'.$booking->refund_date.'"><span class="badge badge-'.$booking->getRefundColor().'">'.$booking->getRefundTypeList().'</span></span>';
return '<span data-order="' . $booking->refund_date . '"><span class="badge badge-' . $booking->getRefundColor() . '">' . $booking->getRefundTypeList() . '</span></span>';
})
->addColumn('hold', function (Booking $booking) {
return $booking->hold ? ' <span data-order="1" class="badge badge-pill badge-success" title="Hold" data-placement="top" rel="tooltip"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger" title="Hold" data-placement="top" rel="tooltip"><i class="fa fa-times"></i></span>';
})
->addColumn('xx_tkt', function (Booking $booking) {
return '<span data-order="'.$booking->xx_tkt_date.'"><span class="badge badge-'.$booking->getXxTktColor().'">'.$booking->getXxTktTypeList().'</span></span>';
return '<span data-order="' . $booking->xx_tkt_date . '"><span class="badge badge-' . $booking->getXxTktColor() . '">' . $booking->getXxTktTypeList() . '</span></span>';
})
->orderColumn('last_customer_email', function ($query, $order) {
$query->whereHas('customer_mails',
function ($q) use ($order) {
// $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //)
})->orderBy(
$query->whereHas(
'customer_mails',
function ($q) use ($order) {
// $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //)
}
)->orderBy(
CustomerMail::select('sent_at')
->whereColumn('booking_id', 'booking.id')
->orderBy('sent_at', 'DESC')
->limit(1)
, $order);
->limit(1),
$order
);
})
/*
/*
->filterColumn('travelagenda_id', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("travelagenda_id = ?", $keyword);
@ -528,5 +543,3 @@ class RequestController extends Controller
->make(true);
}
}

View file

@ -1,102 +0,0 @@
<?php
namespace App\Http\Controllers\SyS\Tools;
use App\Http\Controllers\Controller;
use App\Models\Booking;
use App\Models\IQContentSite;
use App\Models\IQContentSiteField;
use App\Models\IQContentTree;
use App\Models\IQContentTreeNode;
use App\Models\TravelCountry;
use App\Models\TravelGuide;
use App\Models\TravelNationality;
use App\Models\TravelBooking;
use Illuminate\Support\Str;
use IqContent\LaravelFilemanager\Controllers\FileController;
use IqContent\LaravelFilemanager\Controllers\FolderController;
use IqContent\LaravelFilemanager\Models\IQContentFile;
use Request;
use Validator;
class SysController extends Controller
{
private $tree = [];
/**
* ContentSiteController constructor.
*/
public function __construct()
{
$this->middleware(['sysadmin', '2fa']);
}
public function filterHTML(){
}
//content_links
public function calcu()
{
/*$query = Booking::with('booking_draft_items')->select('booking.*')->where('new_drafts', true);
$query->whereHas('booking_draft_items', function ($q) {
$q->where('comfort', true);
});
$bookings = $query->get();
foreach ($bookings as $booking){
$booking->comfort = true;
$booking->save();
}
*/
$bookings = Booking::orderBy('id', 'DESC')->offset(0)->limit(1000)->get();
// dd("nothing");
$val = [];
$text = "";
$data = [
'text' => $text,
'bookings' => $bookings,
];
return view('sys.tools.links', $data);
}
/*
clean code
$travelGuides = TravelGuide::all();
foreach ($travelGuides as $travelGuide){
if(strpos($travelGuide->full_text, "<h1><br></h1>") !== false){
$val[$travelGuide->id] = "<h1><br></h1>";
}
}
foreach ($travelGuides as $travelGuide){
if(strpos($travelGuide->full_text, "<h1") !== false){
$val[$travelGuide->id] = "<h1";
}
}
$travelGuide = TravelGuide::find(203);
$text = $travelGuide->full_text;
// $new_text = preg_replace('/<h1[^>]*>([\s\S]*?)<\/h1[^>]*>/', '', $TravelGuide->full_text);
*/
public function calcuStore()
{
return redirect()->back();
}
}

View file

@ -99,7 +99,6 @@ class TravelUserBookingFewoController extends Controller
return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])."#collapseBookingNotice");
}
if($data['action'] === 'saveAll'){
return $this->userBookingFewoRepo->update($id, $data);
}