Mail and Booking
This commit is contained in:
parent
62e84637b6
commit
5daea268f7
250 changed files with 5377 additions and 1473 deletions
|
|
@ -24,13 +24,12 @@ class ReportController extends Controller
|
|||
$this->middleware('superadmin');
|
||||
}
|
||||
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
$data = [
|
||||
'text' => "Umsetzung folgt",
|
||||
//'serviceProviders' => ServiceProvider::all(),
|
||||
];
|
||||
return view('_empty', $data);
|
||||
return view('admin.report.bookings', $data);
|
||||
}
|
||||
|
||||
public function providers()
|
||||
|
|
@ -38,10 +37,234 @@ class ReportController extends Controller
|
|||
$data = [
|
||||
'serviceProviders' => ServiceProvider::all(),
|
||||
];
|
||||
return view('admin.report.index', $data);
|
||||
return view('admin.report.service_providers', $data);
|
||||
}
|
||||
|
||||
public function providersExport(){
|
||||
private function prozessBookingSearch()
|
||||
{
|
||||
|
||||
$query = Booking::with( 'customer', 'lead', 'service_provider_entries', 'service_provider_entries.service_provider');
|
||||
|
||||
if(Request::get('filter_travel_date_from') != ""){
|
||||
$travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d");
|
||||
$query->where("start_date", '>=', $travel_date_from);
|
||||
}
|
||||
if(Request::get('filter_travel_date_to') != ""){
|
||||
$travel_date_to = Carbon::parse(Request::get('filter_travel_date_to'))->format("Y-m-d");
|
||||
$query->where("start_date", '<=', $travel_date_to);
|
||||
}
|
||||
|
||||
if(Request::get('filter_booking_date_from') != ""){
|
||||
$travel_date_from = Carbon::parse(Request::get('filter_booking_date_from'))->format("Y-m-d");
|
||||
$query->where("booking_date", '>=', $travel_date_from);
|
||||
}
|
||||
if(Request::get('filter_booking_date_to') != ""){
|
||||
$travel_date_to = Carbon::parse(Request::get('filter_booking_date_to'))->format("Y-m-d");
|
||||
$query->where("booking_date", '<=', $travel_date_to);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function bookingsDatatable()
|
||||
{
|
||||
$query = $this->prozessBookingSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->with('price_total_sum', function() use ($query) {
|
||||
return Util::_number_format($query->sum('price'));
|
||||
})
|
||||
->with('proceed_total_sum', function() use ($query) {
|
||||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
}
|
||||
$all = $query->get();
|
||||
$proceeds = 0;
|
||||
foreach ($all as $v){
|
||||
$proceeds += $v->proceedsRaw();
|
||||
}
|
||||
return Util::_number_format($proceeds);
|
||||
})
|
||||
->addColumn('id', function (Booking $booking) {
|
||||
return '<a data-order="' . $booking->id . '" href="' . route('booking_detail', [$booking->id]) . '" data-id="' . $booking->id . '">' . $booking->id . '</a>';
|
||||
})
|
||||
->addColumn('customer.fullName', function (Booking $booking) {
|
||||
return $booking->customer->fullName();
|
||||
})
|
||||
->addColumn('proceeds', function (Booking $booking) {
|
||||
return $booking->proceeds();
|
||||
})
|
||||
->addColumn('start_date', function (Booking $booking) {
|
||||
return $booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('end_date', function (Booking $booking) {
|
||||
return $booking->getEndDateFormat();
|
||||
})
|
||||
->addColumn('booking_date', function (Booking $booking) {
|
||||
return $booking->getBookingDateFormat();
|
||||
})
|
||||
->addColumn('service_provider.names', function (Booking $booking) {
|
||||
$ret = "";
|
||||
if($booking->service_provider_entries){
|
||||
foreach ($booking->service_provider_entries as $service_provider_entry){
|
||||
$ret .= '<span class="ui-stars">'.$service_provider_entry->service_provider->name." | ";
|
||||
$ret .= $service_provider_entry->getAmountFinalEur()." | ";
|
||||
$ret .= $service_provider_entry->is_cleared ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>';
|
||||
$ret .= "</span><br>";
|
||||
}
|
||||
}
|
||||
return $ret === "" ? "-" : $ret;
|
||||
})
|
||||
->addColumn('lead.status_id', function (Booking $booking) {
|
||||
//umbuchen
|
||||
if($booking->lead->status_id){
|
||||
$color = $booking->lead->status->color;
|
||||
$icon = "";
|
||||
if($booking->lead->status_id == 14 && $booking->lead->is_rebook){
|
||||
$color = '#94ae59';
|
||||
$icon = '<i class="fa fa-check-circle"></i> ';
|
||||
}
|
||||
if($booking->lead->status_id == 14 && !$booking->lead->is_rebook){
|
||||
$icon = '<i class="fa fa-times-circle"></i> ';
|
||||
}
|
||||
return '<span data-order="'.$booking->lead->status_id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$booking->lead->status->name.'</span></span>';
|
||||
}
|
||||
return '<span data-order="0">-</span>';
|
||||
})
|
||||
->filterColumn('customer.fullName', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->whereHas('customer', function ($q) use ($keyword) {
|
||||
$q->where("name", 'LIKE', '%' . $keyword . '%')
|
||||
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
|
||||
});
|
||||
}
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('start_date', 'start_date $1')
|
||||
->orderColumn('start_date', 'start_date $1')
|
||||
->orderColumn('customer.fullName', 'customer.firstname $1')
|
||||
//->orderColumn('lead.status_id', 'lead.status_id $1')
|
||||
//->orderColumn('is_cleared', 'is_cleared $1')
|
||||
->rawColumns(['id', 'lead.status_id', 'service_provider.names'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function bookingsExport(){
|
||||
|
||||
$query = $this->prozessBookingSearch();
|
||||
$query->orderBy("id", 'ASC');
|
||||
|
||||
|
||||
$filename = "file-".date('Y-m-d-H-i-s');
|
||||
$exports = $query->get();
|
||||
$columns = [];
|
||||
|
||||
if(Request::get('export') === "export"){
|
||||
$filename = "Buchungen_".date('Y-m-d-H-i-s');
|
||||
|
||||
$headers = array(
|
||||
'BuchungsID',
|
||||
'Status',
|
||||
'MyJack Nr.',
|
||||
'Reisepreis',
|
||||
'Erlös',
|
||||
'Kunde',
|
||||
'Reisedatum',
|
||||
'bis',
|
||||
'Buchungsdatum',
|
||||
'Reiseland',
|
||||
'Reiseprogramm',
|
||||
'Reiseteilnehmer',
|
||||
'Leistungsträger',
|
||||
'Zahlung',
|
||||
'Zahlungsdatum',
|
||||
'Rechnungsnummer',
|
||||
'abgeschlossen',
|
||||
);
|
||||
$total_price = 0;
|
||||
$total_proceeds = 0;
|
||||
$total_amount_final = 0;
|
||||
|
||||
foreach($exports as $export) {
|
||||
if($export->service_provider_entries->count()){
|
||||
$new = true;
|
||||
foreach ($export->service_provider_entries as $service_provider_entry){
|
||||
if($new){
|
||||
$total_price += $export->getPriceRaw();
|
||||
$total_proceeds += $export->proceedsRaw();
|
||||
}
|
||||
$total_amount_final += $service_provider_entry->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
'BuchungsID' => $new ? $export->id : "",
|
||||
'Status' => $new ? $export->lead->status->name : "",
|
||||
'MyJack Nr.' => $new ? $export->merlin_order_number : "",
|
||||
'Reisepreis' => $new ? $export->price : "",
|
||||
'Erlös' => $new ? $export->proceeds() : "",
|
||||
'Kunde' => $new ? $export->customer->fullName() : "",
|
||||
'Reisedatum' => $new ? $export->getStartDateFormat() : "",
|
||||
'bis' => $new ? $export->getEndDateFormat() : "",
|
||||
'Buchungsdatum' => $new ? $export->getBookingDateFormat() : "",
|
||||
'Reiseland' => $new && $export->travel_country ? $export->travel_country->name : "",
|
||||
'Reiseprogramm' => $new && $export->travel_agenda ? $export->travel_agenda->name : "",
|
||||
'Reiseteilnehmer' => $new ? $export->pax : "",
|
||||
'Leistungsträger' => $service_provider_entry->service_provider->name,
|
||||
'Zahlung' => $service_provider_entry->getAmountFinalEur(),
|
||||
'Zahlungsdatum' => $service_provider_entry->getPaymentDateFormat(),
|
||||
'Rechnungsnummer' => $service_provider_entry->invoice_number,
|
||||
'abgeschlossen' => $service_provider_entry->is_cleared ? 'J' : 'N',
|
||||
|
||||
);
|
||||
$new = false;
|
||||
}
|
||||
}else{
|
||||
$total_price += $export->getPriceRaw();
|
||||
$columns[] = array(
|
||||
'BuchungsID' => $export->id,
|
||||
'Status' => $export->lead->status->name,
|
||||
'MyJack Nr.' => $export->merlin_order_number,
|
||||
'Reisepreis' => $export->price,
|
||||
'Erlös' => $export->proceeds(),
|
||||
'Kunde' => $export->customer->fullName(),
|
||||
'Reisedatum' => $export->getStartDateFormat(),
|
||||
'bis' => $export->getEndDateFormat(),
|
||||
'Buchungsdatum' => $export->getBookingDateFormat(),
|
||||
'Reiseland' => $export->travel_country ? $export->travel_country->name : "",
|
||||
'Reiseprogramm' => $export->travel_agenda ? $export->travel_agenda->name : "",
|
||||
'Reiseteilnehmer' => $export->pax,
|
||||
'Leistungsträger' => "",
|
||||
'Zahlung' => "",
|
||||
'Zahlungsdatum' => "",
|
||||
'Rechnungsnummer' => "",
|
||||
'abgeschlossen' => "",
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
$columns[] = array(
|
||||
'BuchungsID' => "Total",
|
||||
'Status' => "",
|
||||
'MyJack Nr.' => "",
|
||||
'Reisepreis' => Util::_number_format($total_price),
|
||||
'Erlös' => Util::_number_format($total_proceeds),
|
||||
'Kunde' => "",
|
||||
'Reisedatum' => "",
|
||||
'bis' => "",
|
||||
'Buchungsdatum' => "",
|
||||
'Reiseland' => "",
|
||||
'Reiseprogramm' => "",
|
||||
'Reiseteilnehmer' => "",
|
||||
'Leistungsträger' => "",
|
||||
'Zahlung' => Util::_number_format($total_amount_final),
|
||||
'Zahlungsdatum' => "",
|
||||
'Rechnungsnummer' => "",
|
||||
'abgeschlossen' => "",
|
||||
);
|
||||
}
|
||||
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
|
||||
private function prozessProvidersSearch(){
|
||||
|
||||
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer');
|
||||
if(Request::get('filter_is_cleared') != ""){
|
||||
|
|
@ -63,6 +286,87 @@ class ReportController extends Controller
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function providersDatatable()
|
||||
{
|
||||
$query = $this->prozessProvidersSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->with('price_total_sum', function() use ($query) {
|
||||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
}
|
||||
$all = $query->get();
|
||||
$price = 0;
|
||||
$isset = [];
|
||||
foreach ($all as $v){
|
||||
$price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceRaw();
|
||||
$isset[] = $v->booking->lead_id;
|
||||
}
|
||||
return Util::_number_format($price);
|
||||
})
|
||||
->with('proceed_total_sum', function() use ($query) {
|
||||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
}
|
||||
$all = $query->get();
|
||||
$proceeds = 0;
|
||||
$isset = [];
|
||||
foreach ($all as $v){
|
||||
$proceeds += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->proceedsRaw();
|
||||
$isset[] = $v->booking->lead_id;
|
||||
}
|
||||
return Util::_number_format($proceeds);
|
||||
/*$all = $query->get();
|
||||
$proceeds = 0;
|
||||
foreach ($all as $v){
|
||||
$proceeds += $v->proceedsRaw();
|
||||
}
|
||||
return Util::_number_format($proceeds);*/
|
||||
})
|
||||
->addColumn('booking.id', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return '<a data-order="' . $serviceProviderEntry->booking->id . '" href="' . route('booking_detail', [$serviceProviderEntry->booking->id]) . '" data-id="' . $serviceProviderEntry->booking->id . '">' . $serviceProviderEntry->booking->id . '</a>';
|
||||
})
|
||||
->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->customer->fullName();
|
||||
})
|
||||
->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->proceeds();
|
||||
})
|
||||
->addColumn('booking.start_date', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('booking.end_date', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->getEndDateFormat();
|
||||
})
|
||||
->addColumn('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->is_cleared ? ' <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>';
|
||||
})
|
||||
->filterColumn('booking.customer.fullName', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->whereHas('booking', function ($q) use ($keyword) {
|
||||
$q->whereHas('customer', function ($q) use ($keyword) {
|
||||
$q->where("name", 'LIKE', '%' . $keyword . '%')
|
||||
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
->orderColumn('booking.id', 'booking.id $1')
|
||||
->orderColumn('booking.start_date', 'booking.start_date $1')
|
||||
->orderColumn('booking.end_date', 'booking.end_date $1')
|
||||
->orderColumn('is_cleared', 'is_cleared $1')
|
||||
->rawColumns(['is_cleared', 'booking.id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function providersExport()
|
||||
{
|
||||
$query = $this->prozessProvidersSearch();
|
||||
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$q->orderBy("lead_id", 'ASC');
|
||||
});
|
||||
|
|
@ -70,6 +374,7 @@ class ReportController extends Controller
|
|||
$filename = "file-".date('Y-m-d-H-i-s');
|
||||
$exports = $query->get();
|
||||
$columns = [];
|
||||
|
||||
if(Request::get('export') === "export"){
|
||||
$filename = "Export_".date('Y-m-d-H-i-s');
|
||||
|
||||
|
|
@ -91,8 +396,16 @@ class ReportController extends Controller
|
|||
'Konto',
|
||||
);
|
||||
$isset = [];
|
||||
$total_price = 0;
|
||||
$total_amount_final = 0;
|
||||
$total_proceeds = 0;
|
||||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
if($new){
|
||||
$total_price += $export->booking->getPriceRaw();
|
||||
$total_proceeds += $export->booking->proceedsRaw();
|
||||
}
|
||||
$total_amount_final += $export->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
'Zähler' => $new ? $export->getCounter() : "",
|
||||
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
|
||||
|
|
@ -112,6 +425,23 @@ class ReportController extends Controller
|
|||
);
|
||||
$isset[] = $export->booking->lead_id;
|
||||
}
|
||||
$columns[] = array(
|
||||
'Zähler' => "Total",
|
||||
'MyJack Nr.' => "",
|
||||
'CRM Nr' => "",
|
||||
'Kunde' =>"",
|
||||
'Reisedatum' => "",
|
||||
'Gesamtreisepreis' => Util::_number_format($total_price),
|
||||
'Reiseland' => "",
|
||||
'Reiseprogramm' => "",
|
||||
'Reiseteilnehmer' => "",
|
||||
'Leistungsträger' => "",
|
||||
'Rechnungsnummer' => "",
|
||||
'Zahlung' => Util::_number_format($total_amount_final),
|
||||
'Zahlungsdatum' => "",
|
||||
'Erlös' => Util::_number_format($total_proceeds),
|
||||
'Konto' => ""
|
||||
);
|
||||
}
|
||||
if(Request::get('export') === "export_lt"){
|
||||
$filename = "Export_LT_".date('Y-m-d-H-i-s');
|
||||
|
|
@ -131,8 +461,14 @@ class ReportController extends Controller
|
|||
'ZahlungVorgang',
|
||||
);
|
||||
$isset = [];
|
||||
$total_amount_final = 0;
|
||||
$payments_total = 0;
|
||||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
if($new) {
|
||||
$payments_total += $export->booking->getServiceProviderPaymentsTotalRaw();
|
||||
}
|
||||
$total_amount_final += $export->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
'Zähler' => $new ? $export->getCounter() : "",
|
||||
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
|
||||
|
|
@ -149,67 +485,23 @@ class ReportController extends Controller
|
|||
);
|
||||
$isset[] = $export->booking->lead_id;
|
||||
}
|
||||
$columns[] = array(
|
||||
'Zähler' => "Total",
|
||||
'MyJack Nr.' => "",
|
||||
'CRM Nr' => "",
|
||||
'Kunde' => "",
|
||||
'Reisedatum' => "",
|
||||
'Reiseland' => "",
|
||||
'Reiseprogramm' => "",
|
||||
'Reiseteilnehmer' => "",
|
||||
'Leistungsträger' => "",
|
||||
'Rechnungsnummer' => "",
|
||||
'Zahlung' => Util::_number_format($total_amount_final),
|
||||
'ZahlungVorgang' => Util::_number_format($payments_total),
|
||||
);
|
||||
}
|
||||
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function providersDatatable()
|
||||
{
|
||||
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer');
|
||||
|
||||
if(Request::get('filter_is_cleared') != ""){
|
||||
$query->where('is_cleared', '=', Request::get('filter_is_cleared'));
|
||||
}
|
||||
if(Request::get('filter_service_provider_id') != ""){
|
||||
$query->where('service_provider_id', '=', Request::get('filter_service_provider_id'));
|
||||
}
|
||||
if(Request::get('filter_travel_date_from') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d");
|
||||
$q->where("start_date", '>=', $travel_date_from);
|
||||
});
|
||||
}
|
||||
if(Request::get('filter_travel_date_to') != ""){
|
||||
$query->whereHas('booking', function ($q) {
|
||||
$travel_date_to = Carbon::parse(Request::get('filter_travel_date_to'))->format("Y-m-d");
|
||||
$q->where("start_date", '<=', $travel_date_to);
|
||||
});
|
||||
}
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->customer->fullName();
|
||||
})
|
||||
->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->proceeds();
|
||||
})
|
||||
->addColumn('booking.start_date', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->booking->getStartDateFormat();
|
||||
})
|
||||
->addColumn('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) {
|
||||
return $serviceProviderEntry->is_cleared ? ' <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>';
|
||||
})
|
||||
->filterColumn('booking.customer.fullName', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->whereHas('booking', function ($q) use ($keyword) {
|
||||
$q->whereHas('customer', function ($q) use ($keyword) {
|
||||
$q->where("name", 'LIKE', '%' . $keyword . '%')
|
||||
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
->orderColumn('booking.start_date', 'booking.start_date $1')
|
||||
->orderColumn('is_cleared', 'is_cleared $1')
|
||||
->rawColumns(['is_cleared'])
|
||||
->make(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Models\BookingDraftItem;
|
|||
use App\Models\Customer;
|
||||
use App\Repositories\BookingRepository;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\DraftRepository;
|
||||
use Request;
|
||||
|
||||
class BookingController extends Controller
|
||||
|
|
@ -64,7 +65,7 @@ class BookingController extends Controller
|
|||
|
||||
$i = 1;
|
||||
|
||||
if($data['action'] == 'addItemUp'){
|
||||
if($data['action'] === 'addItemUp'){
|
||||
$travel_program_id = null;
|
||||
$request_date = null;
|
||||
$comfort = 0;
|
||||
|
|
@ -98,8 +99,6 @@ class BookingController extends Controller
|
|||
]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if(isset($data['draft_item'])){
|
||||
|
||||
foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item){
|
||||
|
|
@ -116,12 +115,10 @@ class BookingController extends Controller
|
|||
$draft_item['in_pdf'] = isset($draft_item['in_pdf']) ? true : false;
|
||||
$BookingDraftItem->fill($draft_item);
|
||||
|
||||
|
||||
$BookingDraftItem->save();
|
||||
}
|
||||
}
|
||||
|
||||
if($data['action'] == 'addItemDown'){
|
||||
if($data['action'] === 'addItemDown'){
|
||||
$travel_program_id = null;
|
||||
$request_date = null;
|
||||
$comfort = 0;
|
||||
|
|
@ -183,7 +180,6 @@ class BookingController extends Controller
|
|||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id]));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -193,11 +189,11 @@ class BookingController extends Controller
|
|||
if(Request::ajax()){
|
||||
$data['customers'] = [];
|
||||
if($data['action'] === "new-customer-mail" && isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])){
|
||||
$tmp = "";
|
||||
$tmp .= $booking->customer ? $booking->customer->email." | " : "- | ";
|
||||
$tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
|
||||
$tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
|
||||
$tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
|
||||
$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."" : "-";
|
||||
$data['customers'][$booking->id] = $tmp;
|
||||
}
|
||||
$ret = CustomerMailRepository::loadModal($data);
|
||||
|
|
@ -215,7 +211,17 @@ class BookingController extends Controller
|
|||
return redirect(route('booking_detail', [$booking->id]));
|
||||
}
|
||||
|
||||
public function action($action, $id=false){
|
||||
|
||||
if($action === 'change_travel_dates'){
|
||||
if($booking = Booking::find($id)){
|
||||
$draftRepo = new DraftRepository($booking);
|
||||
$draftRepo->change_dates_drafts_from_booking(Request::get('change_travel_start_date'));
|
||||
\Session()->flash('alert-success', __('Datum der Reise wurde geändert'));
|
||||
return redirect(route('booking_detail', [$booking->id]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ class CMSContentCountryController extends Controller
|
|||
{
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['contact_emails'])){
|
||||
$data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails']));
|
||||
}else{
|
||||
$data['contact_emails'] = null;
|
||||
}
|
||||
if(!isset($data['contact_lands'])){
|
||||
$data['contact_lands'] = null;
|
||||
}
|
||||
|
|
|
|||
114
app/Http/Controllers/CustomerFileController.php
Executable file
114
app/Http/Controllers/CustomerFileController.php
Executable file
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\BookingApplication;
|
||||
use App\Models\BookingConfirmation;
|
||||
use App\Models\BookingStorno;
|
||||
use App\Models\BookingVoucher;
|
||||
use App\Models\Coupon;
|
||||
use App\Models\InsuranceCertificate;
|
||||
use App\Models\TravelInsurance;
|
||||
use App\Repositories\CustomerFileRepository;
|
||||
use App\Services\CreateCouponPDF;
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Request;
|
||||
use Response;
|
||||
|
||||
class CustomerFileController extends Controller
|
||||
{
|
||||
|
||||
protected $customerFileRepo;
|
||||
|
||||
public function __construct(CustomerFileRepository $customerFileRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->customerFileRepo = $customerFileRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
];
|
||||
return view('customer.mail.index', $data);
|
||||
}
|
||||
|
||||
public function show($model, $id, $cd = false){
|
||||
|
||||
$content_disposition = $cd ? 'attachment' : 'inline';
|
||||
|
||||
$file = false;
|
||||
$filename = "";
|
||||
switch ($model){
|
||||
case 'booking_application':
|
||||
if($booking_application = BookingApplication::find($id)){
|
||||
$filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf";
|
||||
$file = base64_decode($booking_application->binary_data);
|
||||
}
|
||||
break;
|
||||
case 'booking_confirmation':
|
||||
if($booking_confirmation = BookingConfirmation::find($id)){
|
||||
$filename = "Reisebestaetigung-".$booking_confirmation->booking->getBookingNumber().".pdf";
|
||||
$file = base64_decode($booking_confirmation->binary_data);
|
||||
}
|
||||
break;
|
||||
case 'booking_storno':
|
||||
if($booking_stornos = BookingStorno::find($id)){
|
||||
$filename = "Reisestornierung-".$booking_stornos->booking->getBookingNumber().".pdf";
|
||||
$file = base64_decode($booking_stornos->binary_data);
|
||||
}
|
||||
break;
|
||||
case 'coupon':
|
||||
if($coupon = Coupon::find($id)){
|
||||
$filename = "Gutschein-".$coupon->number.".pdf";
|
||||
|
||||
$pdf = new CreateCouponPDF($coupon);
|
||||
$pdf->create();
|
||||
return $pdf->output($filename, $cd);
|
||||
|
||||
}
|
||||
break;
|
||||
case 'booking_voucher':
|
||||
if($booking_vouchers = BookingVoucher::find($id)){
|
||||
$filename = "Voucher-".$booking_vouchers->booking->getBookingNumber().".pdf";
|
||||
$file = base64_decode($booking_vouchers->binary_data);
|
||||
}
|
||||
break;
|
||||
case 'insurance_certificate':
|
||||
if($insurance_certificate = InsuranceCertificate::find($id)){
|
||||
$filename = $insurance_certificate->filename;
|
||||
$file = base64_decode($insurance_certificate->binary_data);
|
||||
}
|
||||
break;
|
||||
case 'travel_insurance':
|
||||
if($booking_application = TravelInsurance::find($id)){
|
||||
$filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf";
|
||||
$file = base64_decode($booking_application->binary_data);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($file){
|
||||
return Response::make($file, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => $content_disposition.'; filename="'.$filename.'"'
|
||||
]);
|
||||
}
|
||||
|
||||
die( 'error' );
|
||||
}
|
||||
|
||||
|
||||
//$path = storage_path($filename); //file_get_contents($path)
|
||||
|
||||
//return response()->file($pathToFile, $headers);
|
||||
//return response()->download($pathToFile, $name, $headers);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ use App\Models\Customer;
|
|||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\CustomerFileRepository;
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
|
@ -64,9 +64,14 @@ class CustomerMailController extends Controller
|
|||
}
|
||||
|
||||
public function delete($id){
|
||||
/*
|
||||
\Session()->flash('alert-success', __('Eintrag gelöscht'));
|
||||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
$customer_mail = CustomerMail::find($id);
|
||||
$customer_mail->dir = 12;
|
||||
$customer_mail->travel_country_id = null;
|
||||
$customer_mail->draft = false;
|
||||
$customer_mail->save();
|
||||
|
||||
\Session()->flash('alert-success', __('Mail gelöscht'));
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -108,7 +113,11 @@ class CustomerMailController extends Controller
|
|||
public function sendMail(CustomerMailRepository $customerMailRepository){
|
||||
$data = Request::all();
|
||||
$customerMailRepository->sendAndStore($data);
|
||||
\Session()->flash('alert-success', "Mails gesendet!");
|
||||
if($data['action'] == 'draft'){
|
||||
\Session()->flash('alert-success', "Entwurf gespeichert!");
|
||||
}else{
|
||||
\Session()->flash('alert-success', "Mail gesendet!");
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
|
@ -168,10 +177,9 @@ class CustomerMailController extends Controller
|
|||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
public function uploadAttachment($id){
|
||||
|
||||
$fileRepo = new FileRepository(new CustomerFile());
|
||||
$fileRepo = new CustomerFileRepository(new CustomerFile());
|
||||
if($id === 'tmp'){
|
||||
$fileRepo->_set('disk', 'customer');
|
||||
$fileRepo->_set('dir', '/attachment/'.date('Y/m').'/');
|
||||
|
|
@ -186,6 +194,124 @@ class CustomerMailController extends Controller
|
|||
'code' => 200
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function ajax(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
$status = false;
|
||||
if(Request::ajax()){
|
||||
if($data['action'] === 'toggle_important'){
|
||||
$customer_mail = CustomerMail::find($data['id']);
|
||||
$customer_mail->important = ($customer_mail->important ? false : true);
|
||||
$customer_mail->save();
|
||||
$status = 'success';
|
||||
}
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
||||
}
|
||||
|
||||
private function getSearchRequests()
|
||||
{
|
||||
if (!Request::get('booking_id')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = CustomerMail::where('booking_id', '=', Request::get('booking_id'));
|
||||
if (Request::get('customer_mail_dir') == 11) { //draft
|
||||
$query->where('draft', '=', true);
|
||||
}else{
|
||||
$query->where('dir', '=', Request::get('customer_mail_dir')); //with('lead'
|
||||
|
||||
}
|
||||
if (Request::get('customer_mail_country')) {
|
||||
$query->where('travel_country_id', '=', Request::get('customer_mail_country'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getRequests(){
|
||||
|
||||
$query = $this->getSearchRequests();
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('checkbox', function (CustomerMail $customer_mail) {
|
||||
return '<div class="message-checkbox mr-1">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input">
|
||||
<span class="custom-control-label"></span>
|
||||
</label>
|
||||
</div>';
|
||||
})
|
||||
->addColumn('important', function (CustomerMail $customer_mail) {
|
||||
$icon = ($customer_mail->important ? 'ion-md-star' : 'ion-md-star-outline');
|
||||
return '<a href="javascript:void(0)" class="ion '.$icon.' d-block text-secondary text-big mr-3 customer-mail-ajax-action"
|
||||
data-url="'.route('customer_mail_ajax').'" data-id="'.$customer_mail->id.'" data-important="'.$customer_mail->important.'" data-action="toggle_important"></a>';
|
||||
})
|
||||
->addColumn('subject', function (CustomerMail $customer_mail) {
|
||||
|
||||
$icon = $customer_mail->reply_id ? 'ion-ios-redo' : 'ion-ios-mail';
|
||||
$badge = $customer_mail->is_answer ? 'badge-next' : 'badge-secondary';
|
||||
$badge = $customer_mail->draft ? 'badge-default' : $badge;
|
||||
$to_icon = $customer_mail->draft ? '<i class="ion ion-ios-warning" style="opacity: 0.7"></i>' : '';
|
||||
$action = $customer_mail->draft ? 'edit-customer-mail' : 'show-customer-mail';
|
||||
$id = $customer_mail->draft ? $customer_mail->id : 'new';
|
||||
$url = $customer_mail->draft ? route('customer_mail_send_mail') : '';
|
||||
|
||||
return '<a href="javascript:void(0)" class="badge '.$badge.'" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="'.$id.'" data-model="customerMail"
|
||||
data-action="'.$action.'" data-url="'.$url.'" data-redirect="back"
|
||||
data-customer_mail_id="'.$customer_mail->id.'" data-route="'.route('booking_modal_load').'">
|
||||
'.$to_icon.'<i class="ion '.$icon.' ui-w-30 text-center" style="opacity: 0.7"></i>'.$customer_mail->subject.'
|
||||
'.($customer_mail->customer_files->count() ? ' <i class="ion ion-md-attach"> <span class="badge badge-primary indicator">'.$customer_mail->customer_files->count().'</span></i>' : '');
|
||||
|
||||
})
|
||||
->addColumn('date', function (CustomerMail $customer_mail) {
|
||||
if($customer_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
})
|
||||
->addColumn('action', function (CustomerMail $customer_mail) {
|
||||
$ret = '';
|
||||
if(!$customer_mail->draft){
|
||||
$ret = '<a href="javascript:void(0)" class="btn btn-xs btn-secondary" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-send" data-model="customerMail" data-action="new-customer-mail"
|
||||
data-url="'.route('customer_mail_send_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_country="'.$customer_mail->travel_country_id.'">
|
||||
<span title="Antwort auf E-Mail senden" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-open"></i></span>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0)" class="btn btn-xs btn-default" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-save" data-model="customerMail" data-action="reply-customer-mail"
|
||||
data-url="'.route('customer_mail_reply_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-booking_id="'.$customer_mail->booking_id.'" data-route="'.route('booking_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_country="'.$customer_mail->travel_country_id.'">
|
||||
<span title="Antwort auf E-Mail speichern" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-unread"></i></span>
|
||||
</a>
|
||||
';
|
||||
}
|
||||
$ret .= '<a href="'.route('customer_mail_delete', [$customer_mail->id]).'" class="btn btn-xs btn-default text-danger" onclick="return confirm(\'In den Papierkorb verschieben?\');"><i class="ion ion-md-trash"></i></a>';
|
||||
return '<div style="white-space: nowrap;">'.$ret.'</div>';
|
||||
})
|
||||
/* ->filter(function ($query) {
|
||||
if (request()->has('search.value')) {
|
||||
$query->where('subject', 'like', "%" . request('search.value') . "%");
|
||||
}
|
||||
if (request()->has('data_table_search')) {
|
||||
$query->where('subject', 'like', "%" . request('data_table_search') . "%");
|
||||
}
|
||||
|
||||
})*/
|
||||
/*->filterColumn('subject', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("subject LIKE ?", '%'.$keyword.'%');
|
||||
|
||||
}
|
||||
})*/
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
->orderColumn('subject', 'subject $1')
|
||||
->orderColumn('important', 'important $1')
|
||||
->rawColumns(['checkbox', 'important', 'subject', 'date', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ class HomeController extends Controller
|
|||
$booking_id = str_replace('drafts_edit_booking_', '', $show);
|
||||
return redirect(route('booking_detail', [$booking_id]));
|
||||
}
|
||||
if(strpos($show, 'edit_booking_') !== false){
|
||||
$booking_id = str_replace('edit_booking_', '', $show);
|
||||
return redirect(route('booking_detail', [$booking_id]));
|
||||
}
|
||||
if($show == 'requests'){
|
||||
return redirect(route('requests'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Booking;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Models\Status;
|
||||
use App\Models\Sym\TravelCountry;
|
||||
use App\Models\TravelAgenda;
|
||||
|
|
@ -32,6 +34,8 @@ class RequestController extends Controller
|
|||
$filter_refund = Booking::$refund_types;
|
||||
$filter_xx_tkt = Booking::$xx_tkt_types;
|
||||
|
||||
$filter_airlines = Airline::get()->pluck('name', 'id')->toArray();
|
||||
|
||||
unset($filter_paying_out[0]);
|
||||
unset($filter_refund[0]);
|
||||
unset($filter_xx_tkt[0]);
|
||||
|
|
@ -44,6 +48,7 @@ class RequestController extends Controller
|
|||
'filter_paying_out_status' => $filter_paying_out_status,
|
||||
'filter_refund' => $filter_refund,
|
||||
'filter_xx_tkt' => $filter_xx_tkt,
|
||||
'filter_airlines' => $filter_airlines,
|
||||
];
|
||||
return view('request.index', $data);
|
||||
}
|
||||
|
|
@ -73,7 +78,7 @@ class RequestController extends Controller
|
|||
*/
|
||||
private function getSearchRequests(){
|
||||
|
||||
$query = Booking::with('lead')->where('lead_id', '!=', NULL);
|
||||
$query = Booking::with('lead')->with('customer_mails')->where('lead_id', '!=', NULL);
|
||||
|
||||
if(Request::get('full_firstname_search') != ""){
|
||||
$query->where('participant_firstname', 'LIKE', '%'.Request::get('full_firstname_search').'%');
|
||||
|
|
@ -109,6 +114,9 @@ class RequestController extends Controller
|
|||
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_id', '=', Request::get('travel_option_airline_id'));
|
||||
}
|
||||
|
||||
|
||||
// $query->where('end_date', '<=', $now);
|
||||
|
|
@ -218,7 +226,6 @@ class RequestController extends Controller
|
|||
return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
|
|
@ -227,11 +234,11 @@ class RequestController extends Controller
|
|||
$query = $this->getSearchRequests();
|
||||
$bookings = $query->orderBy('id', 'DESC')->limit(50)->get();
|
||||
foreach ($bookings as $booking){
|
||||
$tmp = "";
|
||||
$tmp .= $booking->customer ? $booking->customer->email." | " : "- | ";
|
||||
$tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
|
||||
$tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
|
||||
$tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
|
||||
$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."" : "-";
|
||||
$data['customers'][$booking->id] = $tmp;
|
||||
}
|
||||
$ret = CustomerMailRepository::loadModal($data);
|
||||
|
|
@ -294,22 +301,17 @@ class RequestController extends Controller
|
|||
$icon = '<i class="fa fa-times-circle"></i> ';
|
||||
}
|
||||
return '<span data-order="'.$booking->lead->status_id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$booking->lead->status->name.'</span></span>';
|
||||
|
||||
}
|
||||
return '<span data-order="0">-</span>';
|
||||
})
|
||||
->addColumn('last_customer_email', function (Booking $booking) {
|
||||
//umbuchen
|
||||
if($booking->customer_mails->count()){
|
||||
|
||||
$customer_mail = $booking->customer_mails_sent_at->last();
|
||||
|
||||
return '<a href="'.route('booking_detail', [$booking->id]).'#collapseBookingMails" data-order="'.$customer_mail->sent_at.'"><span class="badge '.($customer_mail->is_answer ? 'badge-default' : 'badge-secondary').'">'.$customer_mail->sent_at.'</span></a>';
|
||||
|
||||
return '<a data-order="'.$customer_mail->getSentAtRaw().'" href="'.route('booking_detail', [$booking->id]).'#collapseBookingMails" data-order="'.$customer_mail->sent_at.'"><span class="badge '.($customer_mail->is_answer ? 'badge-default' : 'badge-secondary').'">'.$customer_mail->sent_at.'</span></a>';
|
||||
}
|
||||
return '<span data-order="0">-</span>';
|
||||
return '<span data-order="">-</span>';
|
||||
})
|
||||
|
||||
->addColumn('paying_out', function (Booking $booking) {
|
||||
$icon = "";
|
||||
$badge = $booking->getPayingOutColor();
|
||||
|
|
@ -325,21 +327,33 @@ class RequestController extends Controller
|
|||
->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>';
|
||||
})
|
||||
|
||||
|
||||
->addColumn('airline_id', function (Booking $booking) {
|
||||
return $booking->airline ? '<span data-order="'.$booking->airline_id.'">'.$booking->airline->name.'</span>' : '-';
|
||||
})
|
||||
->addColumn('refund', function (Booking $booking) {
|
||||
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"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><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>';
|
||||
})
|
||||
/* ->filterColumn('travel_country_id', function($query, $keyword) {
|
||||
|
||||
if($keyword != "") {
|
||||
$query->whereRaw("travel_country_id = ?", $keyword);
|
||||
}
|
||||
->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(
|
||||
CustomerMail::select('sent_at')
|
||||
->whereColumn('booking_id', 'booking.id')
|
||||
->orderBy('sent_at', 'DESC')
|
||||
->limit(1)
|
||||
, $order);
|
||||
})
|
||||
|
||||
/*
|
||||
->filterColumn('travelagenda_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("travelagenda_id = ?", $keyword);
|
||||
|
|
@ -359,9 +373,11 @@ class RequestController extends Controller
|
|||
->orderColumn('paying_out', 'paying_out $1')
|
||||
->orderColumn('paying_out_status', 'paying_out_status $1')
|
||||
->orderColumn('refund', 'refund_date $1')
|
||||
->orderColumn('airline_id', 'airline_id $1')
|
||||
->orderColumn('hold', 'hold $1')
|
||||
->orderColumn('xx_tkt', 'xx_tkt_date $1')
|
||||
->orderColumn('travel_documents', 'travel_documents $1')
|
||||
->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'paying_out', 'paying_out_status', 'refund', 'xx_tkt'])
|
||||
->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
70
app/Http/Controllers/Settings/AirlineController.php
Executable file
70
app/Http/Controllers/Settings/AirlineController.php
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Booking;
|
||||
use Request;
|
||||
|
||||
class AirlineController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'airline' => Airline::all(),
|
||||
];
|
||||
return view('settings.airline.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['contact_emails'])){
|
||||
$data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails']));
|
||||
}else{
|
||||
$data['contact_emails'] = null;
|
||||
}
|
||||
if($data['id'] === "new"){
|
||||
$model = Airline::create($data);
|
||||
}else{
|
||||
$model = Airline::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->name_full = $data['name_full'];
|
||||
$model->contact_emails = $data['contact_emails'];
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_airline'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
//TODO check ist linked
|
||||
/*if(Booking::where('travelagenda_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}*/
|
||||
|
||||
$model = Airline::findOrFail($id);
|
||||
|
||||
if(Booking::where('airline_id', $model->id)->count()){
|
||||
\Session()->flash('alert-error', 'Fehler: Airline in Buchnungen verwendet.');
|
||||
return redirect()->back();
|
||||
}
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5,8 +5,6 @@ namespace App\Http\Controllers\Settings;
|
|||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Status;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelNationalityRequirement;
|
||||
use Request;
|
||||
|
||||
class BookingStatusController extends Controller
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ namespace App\Http\Controllers\Settings;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Keyword;
|
||||
use App\Models\TravelAgenda;
|
||||
use Request;
|
||||
|
||||
class KeywordController extends Controller
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue