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
|
||||
|
|
|
|||
49
app/Libraries/CouponPDF.php
Normal file
49
app/Libraries/CouponPDF.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
|
||||
use \setasign\Fpdi\Fpdi;
|
||||
|
||||
class CouponPDF extends Fpdi
|
||||
{
|
||||
|
||||
protected $_tplIdx;
|
||||
protected $is_static_coupon;
|
||||
|
||||
public function _set($name, $value){
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
public function Header()
|
||||
{
|
||||
if($this->is_static_coupon){
|
||||
$file = './pdf/coupon/images/coupon-background.pdf';
|
||||
}else{
|
||||
$file = './pdf/coupon/images/coupon-background1.pdf';
|
||||
|
||||
}
|
||||
|
||||
if (null === $this->_tplIdx) {
|
||||
$this->setSourceFile($file);
|
||||
$this->_tplIdx = $this->importPage(1);
|
||||
}
|
||||
$this->useTemplate($this->_tplIdx);
|
||||
|
||||
}
|
||||
|
||||
/*function Footer() {
|
||||
$this->SetFont('Helvetica', '', 10);
|
||||
|
||||
$this->SetXY(15, 260);
|
||||
$this->Cell(180, 0, '', 'T');
|
||||
$this->Ln();
|
||||
$this->SetXY(15, 261);
|
||||
|
||||
$this->MultiCell(180, 6, utf8_decode($this->_footer_data), 0, 'C');
|
||||
$this->Ln();
|
||||
|
||||
} // end of footer
|
||||
*/
|
||||
|
||||
}
|
||||
56
app/Models/Airline.php
Normal file
56
app/Models/Airline.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Airline
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $name_full
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @package App\Models
|
||||
* @property array|null $contact_emails
|
||||
* @property array|null $emails
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereContactEmails($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereEmails($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereNameFull($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Airline extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'airlines';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'name_full',
|
||||
'emails',
|
||||
'contact_emails',
|
||||
];
|
||||
|
||||
protected $casts = ['contact_emails' => 'array'];
|
||||
|
||||
public function getContactEmailsStr($glue=PHP_EOL){
|
||||
if($this->contact_emails){
|
||||
return implode($glue, $this->contact_emails);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Arrangement
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ArrangementTemplate
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ArrangementType
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace App\Models;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Booking
|
||||
|
|
@ -116,6 +116,44 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read int|null $service_provider_entries_count
|
||||
* @property float|null $canceled
|
||||
* @property float|null $price_canceled
|
||||
* @property int|null $paying_out
|
||||
* @property int|null $paying_out_status
|
||||
* @property int|null $airline_id
|
||||
* @property int|null $refund
|
||||
* @property \Illuminate\Support\Carbon|null $refund_date
|
||||
* @property int|null $hold
|
||||
* @property int|null $xx_tkt
|
||||
* @property string|null $xx_tkt_date
|
||||
* @property string|null $filekey
|
||||
* @property-read \App\Models\Airline|null $airline
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails
|
||||
* @property-read int|null $customer_mails_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails_sent_at
|
||||
* @property-read int|null $customer_mails_sent_at_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereAirlineId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCanceled($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFilekey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereHold($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOut($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOutStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceCanceled($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefund($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefundDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTkt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTktDate($value)
|
||||
* @property int|null $is_rail_fly
|
||||
* @property string|null $notice
|
||||
* @property-read \App\Models\CustomerMail $customer_mail_last
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereIsRailFly($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNotice($value)
|
||||
* @property-read int|null $booking_applications_count
|
||||
* @property-read int|null $booking_confirmations_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingStorno[] $booking_stornos
|
||||
* @property-read int|null $booking_stornos_count
|
||||
* @property-read int|null $booking_vouchers_count
|
||||
* @property-read int|null $travel_insurances_count
|
||||
*/
|
||||
class Booking extends Model
|
||||
{
|
||||
|
|
@ -144,6 +182,8 @@ class Booking extends Model
|
|||
'final_payment' => 'float',
|
||||
'travelagenda_id' => 'int',
|
||||
'paying_out' => 'int',
|
||||
'hold' => 'int',
|
||||
'airline_id' => 'int',
|
||||
'refund' => 'int',
|
||||
'xx_tkt' => 'int',
|
||||
|
||||
|
|
@ -192,6 +232,8 @@ class Booking extends Model
|
|||
'travelagenda_id',
|
||||
'paying_out',
|
||||
'paying_out_status',
|
||||
'airline_id',
|
||||
'hold',
|
||||
'refund',
|
||||
'refund_date',
|
||||
'xx_tkt',
|
||||
|
|
@ -225,7 +267,14 @@ class Booking extends Model
|
|||
2 => 'erledigt',
|
||||
];
|
||||
|
||||
|
||||
public static $customer_mail_dirs = [
|
||||
0 => ['name' => 'Reisender', 'icon'=>'ion-ios-filing'],
|
||||
1 => ['name' => 'Agentur', 'icon'=>'ion-ios-folder-open'],
|
||||
2 => ['name' => 'Flug', 'icon'=>'ion-ios-airplane'],
|
||||
3 => ['name' => 'Versicherung', 'icon'=>'ion-ios-help-buoy'],
|
||||
11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'],
|
||||
12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'],
|
||||
];
|
||||
protected $paying_out_colors = [
|
||||
0 => '',
|
||||
1 => 'info',
|
||||
|
|
@ -252,6 +301,38 @@ class Booking extends Model
|
|||
1 => 'danger',
|
||||
2 => 'success',
|
||||
];
|
||||
|
||||
/*
|
||||
*
|
||||
* <ul class="tabscontrol flatlist clearfix" id="tabscontrol">
|
||||
<li class="tab"><a href="#customer" class="active"><?php echo __('Kunde') ?></a></li>
|
||||
<?php if ($booking->relatedExists('Application')): ?>
|
||||
<li class="tab"><a href="#application" class="active"><?php echo __('Reiseanmeldung') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('Confirmation')): ?>
|
||||
<li class="tab"><a href="#confirmation" class="active"><?php echo __('Reisebestätigung') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('Invoice')): ?>
|
||||
<li class="tab"><a href="#invoice" class="active"><?php echo __('Rechnung') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('Storno')): ?>
|
||||
<li class="tab"><a href="#storno" class="active"><?php echo __('Storno') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('TravelInsurance')): ?>
|
||||
<li class="tab"><a href="#travelinsurance" class="active"><?php echo __('Versicherung') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('InsuranceCertificate')): ?>
|
||||
<li class="tab"><a href="#insurance" class="active"><?php echo __('Sicherungsschein') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('Voucher')): ?>
|
||||
<li class="tab"><a href="#voucher" class="active"><?php echo __('Voucher') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($booking->relatedExists('Coupon')): ?>
|
||||
<li class="tab"><a href="#coupon" class="active"><?php echo __('Gutscheine') ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
*/
|
||||
|
||||
/*public function branch()
|
||||
{
|
||||
return $this->belongsTo(Branch::class);
|
||||
|
|
@ -303,6 +384,11 @@ class Booking extends Model
|
|||
return $this->belongsTo(TravelAgenda::class, 'travelagenda_id');
|
||||
}
|
||||
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsTo(Airline::class, 'airline_id');
|
||||
}
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany(Arrangement::class);
|
||||
|
|
@ -313,35 +399,18 @@ class Booking extends Model
|
|||
return $this->hasMany(ArrangementType::class);
|
||||
}
|
||||
|
||||
/*public function booking_applications()
|
||||
{
|
||||
return $this->hasMany(BookingApplication::class);
|
||||
}
|
||||
|
||||
public function booking_confirmations()
|
||||
{
|
||||
return $this->hasMany(BookingConfirmation::class);
|
||||
}*/
|
||||
|
||||
public function booking_draft_items()
|
||||
{
|
||||
return $this->hasMany(BookingDraftItem::class)->orderBy('pos', 'ASC');
|
||||
}
|
||||
|
||||
/*public function booking_invoices()
|
||||
{
|
||||
return $this->hasMany(BookingInvoice::class);
|
||||
}*/
|
||||
|
||||
public function booking_service_items()
|
||||
{
|
||||
return $this->hasMany(BookingServiceItem::class);
|
||||
}
|
||||
|
||||
/*public function booking_vouchers()
|
||||
{
|
||||
return $this->hasMany(BookingVoucher::class);
|
||||
}*/
|
||||
|
||||
public function coupons()
|
||||
{
|
||||
|
|
@ -373,11 +442,41 @@ class Booking extends Model
|
|||
{
|
||||
return $this->hasMany(CustomerMail::class, 'booking_id')->orderBy('sent_at', 'ASC');
|
||||
}
|
||||
/*
|
||||
|
||||
public function customer_mail_last()
|
||||
{
|
||||
return $this->hasOne(CustomerMail::class, 'booking_id')->latest();
|
||||
}
|
||||
|
||||
public function booking_applications()
|
||||
{
|
||||
return $this->hasMany(BookingApplication::class);
|
||||
}
|
||||
|
||||
public function booking_confirmations()
|
||||
{
|
||||
return $this->hasMany(BookingConfirmation::class);
|
||||
}
|
||||
|
||||
public function booking_stornos()
|
||||
{
|
||||
return $this->hasMany(BookingStorno::class);
|
||||
}
|
||||
|
||||
/*public function booking_invoices()
|
||||
{
|
||||
return $this->hasMany(BookingInvoice::class);
|
||||
}*/
|
||||
|
||||
public function booking_vouchers()
|
||||
{
|
||||
return $this->hasMany(BookingVoucher::class);
|
||||
}
|
||||
|
||||
public function travel_insurances()
|
||||
{
|
||||
return $this->hasMany(TravelInsurance::class);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
public function calculate_price_total()
|
||||
|
|
@ -461,6 +560,21 @@ class Booking extends Model
|
|||
return Carbon::parse($this->attributes['end_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getBookingDateFormat(){
|
||||
if(!$this->attributes['booking_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['booking_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
//erlös #getRevenueFactor
|
||||
public function proceedsRaw(){
|
||||
$total = 0;
|
||||
foreach ($this->service_provider_entries as $entry)
|
||||
{
|
||||
$total += $entry->amount / $entry->factor;
|
||||
}
|
||||
return $this->attributes['price'] - $total;
|
||||
|
||||
}
|
||||
|
||||
//erlös #getRevenueFactor
|
||||
public function proceeds(){
|
||||
|
|
@ -483,6 +597,16 @@ class Booking extends Model
|
|||
return $total;
|
||||
}
|
||||
|
||||
public function getServiceProviderPaymentsTotalRaw()
|
||||
{
|
||||
$total = 0;
|
||||
foreach ($this->service_provider_entries as $entry)
|
||||
{
|
||||
$total += $entry->amount;
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
public function getServiceProviderPaymentsTotal()
|
||||
{
|
||||
$total = 0;
|
||||
|
|
@ -513,6 +637,16 @@ class Booking extends Model
|
|||
return $this->ev_number;
|
||||
}
|
||||
|
||||
public function getBookingNumber()
|
||||
{
|
||||
if ($this->lead)
|
||||
{
|
||||
return $this->lead->id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getPayingOutType(){
|
||||
return isset(self::$paying_out_types[$this->paying_out]) ? self::$paying_out_types[$this->paying_out] : '-';
|
||||
}
|
||||
|
|
@ -565,5 +699,14 @@ class Booking extends Model
|
|||
return isset($this->xx_tkt_colors[$this->xx_tkt]) ? $this->xx_tkt_colors[$this->xx_tkt] : '-';
|
||||
}
|
||||
|
||||
public function countCustomerMailsBy($dir, $country=false){
|
||||
|
||||
if($dir === 11){
|
||||
return $this->customer_mails->where('draft', true)->count();
|
||||
}
|
||||
if($country){
|
||||
return $this->customer_mails->where('dir', $dir)->where('travel_country_id', $country)->count();
|
||||
}
|
||||
return $this->customer_mails->where('dir', $dir)->count();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
53
app/Models/BookingApplication.php
Normal file
53
app/Models/BookingApplication.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingApplication
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property float $total
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingApplication extends Model
|
||||
{
|
||||
protected $table = 'booking_application';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'total' => 'float',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'total',
|
||||
'binary_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
72
app/Models/BookingConfirmation.php
Normal file
72
app/Models/BookingConfirmation.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingConfirmation
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property float $total
|
||||
* @property float $deposit
|
||||
* @property float $final_payment
|
||||
* @property Carbon $deposit_payment_date
|
||||
* @property Carbon $final_payment_date
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereDeposit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereDepositPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereFinalPayment($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereFinalPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingConfirmation extends Model
|
||||
{
|
||||
protected $table = 'booking_confirmation';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'total' => 'float',
|
||||
'deposit' => 'float',
|
||||
'final_payment' => 'float',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'deposit_payment_date',
|
||||
'final_payment_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'total',
|
||||
'deposit',
|
||||
'final_payment',
|
||||
'deposit_payment_date',
|
||||
'final_payment_date',
|
||||
'binary_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -145,9 +145,15 @@ class BookingDraftItem extends Model
|
|||
public function getStartDateAttribute(){
|
||||
return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date'])->format("d.m.Y") : '';
|
||||
}
|
||||
public function getStartDateRow(){
|
||||
return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date']) : null;
|
||||
}
|
||||
public function getEndDateAttribute(){
|
||||
return isset($this->attributes['end_date']) ? Carbon::parse($this->attributes['end_date'])->format("d.m.Y") : '';
|
||||
}
|
||||
public function getEndDateRow(){
|
||||
return isset($this->attributes['end_date']) ? Carbon::parse($this->attributes['end_date']) : null;
|
||||
}
|
||||
|
||||
public function setStartDateAttribute($value)
|
||||
{
|
||||
|
|
@ -157,6 +163,10 @@ class BookingDraftItem extends Model
|
|||
$this->attributes['start_date'] = (new Carbon($value))->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
public function setStartDateRow($value)
|
||||
{
|
||||
$this->attributes['start_date'] = $value;
|
||||
}
|
||||
public function setEndDateAttribute($value){
|
||||
if (!$value) {
|
||||
$this->attributes['end_date'] = null;
|
||||
|
|
@ -164,6 +174,9 @@ class BookingDraftItem extends Model
|
|||
$this->attributes['end_date'] = (new Carbon($value))->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
public function setEndDateRow($value){
|
||||
$this->attributes['end_date'] = $value;
|
||||
}
|
||||
|
||||
//price_adult
|
||||
public function setPriceAdultAttribute($value)
|
||||
|
|
|
|||
72
app/Models/BookingInvoice.php
Normal file
72
app/Models/BookingInvoice.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingInvoice
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property float $total
|
||||
* @property float $deposit
|
||||
* @property float $final_payment
|
||||
* @property Carbon $deposit_payment_date
|
||||
* @property Carbon $final_payment_date
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereDeposit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereDepositPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereFinalPayment($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereFinalPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingInvoice extends Model
|
||||
{
|
||||
protected $table = 'booking_invoice';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'total' => 'float',
|
||||
'deposit' => 'float',
|
||||
'final_payment' => 'float',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'deposit_payment_date',
|
||||
'final_payment_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'total',
|
||||
'deposit',
|
||||
'final_payment',
|
||||
'deposit_payment_date',
|
||||
'final_payment_date',
|
||||
'binary_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingServiceItem
|
||||
|
|
|
|||
68
app/Models/BookingStorno.php
Normal file
68
app/Models/BookingStorno.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingStorno
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property float $total
|
||||
* @property float $storno
|
||||
* @property Carbon $storno_date
|
||||
* @property boolean $binary_data
|
||||
* @property bool $done
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereDone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStorno($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStornoDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingStorno extends Model
|
||||
{
|
||||
protected $table = 'booking_storno';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'total' => 'float',
|
||||
'storno' => 'float',
|
||||
'done' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'storno_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'total',
|
||||
'storno',
|
||||
'storno_date',
|
||||
'binary_data',
|
||||
'done'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
49
app/Models/BookingVoucher.php
Normal file
49
app/Models/BookingVoucher.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class BookingVoucher
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property boolean $binary_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereBinaryData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class BookingVoucher extends Model
|
||||
{
|
||||
protected $table = 'booking_voucher';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'binary_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CMSAuthor
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace App\Models;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Coupon
|
||||
|
|
@ -44,6 +44,8 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValidDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $text
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereText($value)
|
||||
*/
|
||||
class Coupon extends Model
|
||||
{
|
||||
|
|
@ -90,4 +92,9 @@ class Coupon extends Model
|
|||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function isLegal(){
|
||||
//TODO
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CreditCardType
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace App\Models;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Customer
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CustomerFile
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $customer_id
|
||||
* @property int $customer_mail_id
|
||||
|
|
@ -24,11 +25,26 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @property int $size
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property Customer $customer
|
||||
* @property CustomerMail $customer_mail
|
||||
*
|
||||
* @package App\Models
|
||||
* @property-read \App\User $user
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCustomerMailId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereDir($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereExt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereFilename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereIdentifier($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereMine($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereOriginalName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereSize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CustomerFile extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ namespace App\Models;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CustomerMail
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property int $customer_id
|
||||
|
|
@ -20,8 +20,15 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @property bool $is_answer
|
||||
* @property int $reply_id
|
||||
* @property string $email
|
||||
* @property string $recipient
|
||||
* @property string $cc
|
||||
* @property string $bcc
|
||||
* @property string $subject
|
||||
* @property string $message
|
||||
* @property int $dir
|
||||
* @property int $travel_country_id
|
||||
* @property bool $draft
|
||||
* @property bool $important
|
||||
* @property bool $send
|
||||
* @property bool $fail
|
||||
* @property string $error
|
||||
|
|
@ -30,28 +37,73 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @property Carbon $delivered_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property Booking $booking
|
||||
* @property Customer $customer
|
||||
* @property CustomerMail $customer_mail
|
||||
* @property TravelCountry $travel_country
|
||||
* @property Lead $lead
|
||||
* @property Collection|CustomerFile[] $customer_files
|
||||
* @property Collection|CustomerMail[] $customer_mails
|
||||
*
|
||||
* @package App\Models
|
||||
* @property-read int|null $customer_files_count
|
||||
* @property-read int|null $customer_mails_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereBcc($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCc($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDeliveredAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDir($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDraft($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereError($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereFail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereImportant($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereIsAnswer($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereMessage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereRecipient($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereReplyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereScheduledAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSend($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSentAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubject($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereTravelCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CustomerMail extends Model
|
||||
{
|
||||
protected $table = 'customer_mails';
|
||||
|
||||
public $dir_types = [
|
||||
0 => 'Reisender',
|
||||
1 => 'Agentur',
|
||||
2 => 'Flug',
|
||||
3 => 'Versicherung',
|
||||
11 => 'Entwurf',
|
||||
12 => 'Papierkorb',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'customer_id' => 'int',
|
||||
'lead_id' => 'int',
|
||||
'is_answer' => 'bool',
|
||||
'reply_id' => 'int',
|
||||
'dir' => 'int',
|
||||
'travel_country_id' => 'int',
|
||||
'draft' => 'bool',
|
||||
'important' => 'bool',
|
||||
'send' => 'bool',
|
||||
'fail' => 'bool'
|
||||
'fail' => 'bool',
|
||||
'recipient' => 'array',
|
||||
'cc' => 'array',
|
||||
'bcc' => 'array'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
|
@ -67,8 +119,15 @@ class CustomerMail extends Model
|
|||
'is_answer',
|
||||
'reply_id',
|
||||
'email',
|
||||
'recipient',
|
||||
'cc',
|
||||
'bcc',
|
||||
'subject',
|
||||
'message',
|
||||
'dir',
|
||||
'travel_country_id',
|
||||
'draft',
|
||||
'important',
|
||||
'send',
|
||||
'fail',
|
||||
'error',
|
||||
|
|
@ -92,6 +151,11 @@ class CustomerMail extends Model
|
|||
return $this->belongsTo(CustomerMail::class, 'reply_id');
|
||||
}
|
||||
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo(TravelCountry::class);
|
||||
}
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo(Lead::class);
|
||||
|
|
@ -107,6 +171,9 @@ class CustomerMail extends Model
|
|||
return $this->hasMany(CustomerMail::class, 'reply_id');
|
||||
}
|
||||
|
||||
public function getSentAtRaw(){
|
||||
return $this->attributes['sent_at'];
|
||||
}
|
||||
|
||||
public function getSentAtAttribute(){
|
||||
if(!$this->attributes['sent_at']){ return ""; }
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InitialContactType
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Inquiry
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InquiryTemplate
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InquiryType
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class InsuranceCertificate
|
||||
|
|
@ -44,7 +44,6 @@ class InsuranceCertificate extends Model
|
|||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'internal_id' => 'int',
|
||||
'binary_data' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Keyword
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace App\Models;
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Lead
|
||||
|
|
@ -91,6 +91,8 @@ use Reliese\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read \App\Models\Sym\TravelCountry|null $travel_country_crm
|
||||
* @property bool|null $is_rebook
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereIsRebook($value)
|
||||
*/
|
||||
class Lead extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class LeadParticipant
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Offer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Participant
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Salutation
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Searchengine
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ServiceProvider
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ServiceProviderEntry
|
||||
|
|
@ -102,7 +102,13 @@ class ServiceProviderEntry extends Model
|
|||
$ret = $this->amount_eur;
|
||||
}
|
||||
return number_format($ret, 2, ',', '.');
|
||||
;
|
||||
}
|
||||
|
||||
public function getAmountFinalEurRaw(){
|
||||
if($this->amount_eur && $this->amount_eur > 0){
|
||||
return $this->amount_eur;
|
||||
}
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function getPaymentDateFormat(){
|
||||
|
|
|
|||
|
|
@ -7,20 +7,27 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Status
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property int $handling_days
|
||||
* @property string $color
|
||||
*
|
||||
* @property Collection|Lead[] $leads
|
||||
* @property Collection|StatusHistory[] $status_histories
|
||||
*
|
||||
* @package App\Models
|
||||
* @property-read int|null $leads_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereColor($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereHandlingDays($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Status extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class StatusHistory
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactLands($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Booking[] $bookings
|
||||
* @property-read int|null $bookings_count
|
||||
* @property array|null $contact_emails
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactEmails($value)
|
||||
*/
|
||||
class TravelCountry extends Model
|
||||
{
|
||||
|
|
@ -57,15 +59,14 @@ class TravelCountry extends Model
|
|||
'contact_text_3',
|
||||
'contact_text_4',
|
||||
'contact_footer',
|
||||
'contact_emails',
|
||||
|
||||
];
|
||||
|
||||
protected $casts = ['contact_lands' => 'array'];
|
||||
|
||||
protected $casts = ['contact_lands' => 'array', 'contact_emails' => 'array'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
/*public function leads()
|
||||
{
|
||||
return $this->hasMany(Lead::class, 'travelcountry_id', 'id');
|
||||
|
|
@ -76,8 +77,17 @@ class TravelCountry extends Model
|
|||
return $this->hasMany(Booking::class, 'travel_country_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getCountryLands(){
|
||||
$ret = [];
|
||||
if($this->contact_lands){
|
||||
foreach ($this->contact_lands as $travel_country_id){
|
||||
if($travel_country = TravelCountry::find($travel_country_id)){
|
||||
$ret[$travel_country->id] = $travel_country->name;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$ret[$this->id] = $this->name;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,210 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Booking
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $booking_date
|
||||
* @property int $customer_id
|
||||
* @property int|null $lead_id
|
||||
* @property int|null $new_drafts
|
||||
* @property int $sf_guard_user_id
|
||||
* @property int $branch_id
|
||||
* @property float|null $service_fee
|
||||
* @property int|null $travel_country_id
|
||||
* @property int|null $travel_category_id
|
||||
* @property int|null $pax
|
||||
* @property int|null $coupon_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property string|null $title
|
||||
* @property string|null $start_date
|
||||
* @property string|null $end_date
|
||||
* @property int|null $website_id
|
||||
* @property string|null $travel_number
|
||||
* @property string|null $participant_name
|
||||
* @property string|null $participant_firstname
|
||||
* @property string|null $participant_birthdate
|
||||
* @property int|null $participant_salutation_id
|
||||
* @property string|null $ev_number
|
||||
* @property string|null $merlin_knr
|
||||
* @property string|null $merlin_order_number
|
||||
* @property int|null $travel_company_id
|
||||
* @property int|null $travel_documents
|
||||
* @property float|null $price
|
||||
* @property float|null $price_total
|
||||
* @property float|null $deposit_total
|
||||
* @property float|null $final_payment
|
||||
* @property string|null $final_payment_date
|
||||
* @property int|null $travelagenda_id
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Sym\Arrangement[] $arrangements
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingDraftItem[] $booking_draft_items
|
||||
* @property-read \App\Models\TravelCountry|null $lead
|
||||
* @property-read \App\Models\SfGuardUser $sf_guard_user
|
||||
* @property-read \App\Models\TravelAgenda|null $travel_agenda
|
||||
* @property-read \App\Models\TravelCountry|null $travel_country
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBookingDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBranchId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCouponId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereDepositTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEndDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEvNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPayment($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPaymentDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereLeadId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinKnr($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinOrderNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNewDrafts($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantBirthdate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantFirstname($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantSalutationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereServiceFee($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereSfGuardUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereStartDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCategoryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelDocuments($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelagendaId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking query()
|
||||
* @property-read int|null $arrangements_count
|
||||
* @property-read int|null $booking_draft_items_count
|
||||
*/
|
||||
class _Booking extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $table = 'booking';
|
||||
|
||||
/*protected $fillable = [
|
||||
'pos',
|
||||
];*/
|
||||
|
||||
public function booking_draft_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\BookingDraftItem', 'booking_id', 'id')->orderBy('pos', 'ASC');
|
||||
}
|
||||
|
||||
//on crm
|
||||
public function travel_agenda()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelAgenda', 'travelagenda_id', 'id');
|
||||
}
|
||||
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TravelCountry', 'travel_country_id', 'crm_id');
|
||||
}
|
||||
|
||||
public function lead()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Lead', 'lead_id', 'id');
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\SfGuardUser', 'sf_guard_user_id', 'id');
|
||||
}
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany('App\Models\Sym\Arrangement', 'booking_id', 'id')->orderBy('view_position', 'DESC');
|
||||
}
|
||||
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
$travel_draft_item = false;
|
||||
$travel_price_adult = 0;
|
||||
$travel_price_children = 0;
|
||||
$total_adult = 0;
|
||||
$total_children = 0;
|
||||
foreach ($this->booking_draft_items as $booking_draft_item) {
|
||||
//24 Rundreise
|
||||
if($booking_draft_item->draft_type_id == 24){
|
||||
$travel_draft_item = $booking_draft_item;
|
||||
continue;
|
||||
}
|
||||
$prices = $booking_draft_item->getItemPrice();
|
||||
//Grundpreis Reise
|
||||
if($booking_draft_item->draft_type_id == 30){
|
||||
$travel_price_adult += $prices['adult'];
|
||||
$travel_price_children += $prices['children'];
|
||||
}
|
||||
$total_adult += $prices['adult'];
|
||||
$total_children += $prices['children'];
|
||||
}
|
||||
|
||||
if($travel_draft_item){
|
||||
$travel_draft_item->setPriceAdultRaw($travel_price_adult);
|
||||
$travel_draft_item->setPriceChildrenRaw($travel_price_children);
|
||||
$travel_draft_item->save();
|
||||
}
|
||||
|
||||
$this->price = $total_adult + $total_children;
|
||||
$this->save();
|
||||
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function findBeforeDraftItemRelation($reid)
|
||||
{
|
||||
$before = false;
|
||||
foreach($this->booking_draft_items as $booking_draft_items) {
|
||||
if ($booking_draft_items->id == $reid) {
|
||||
return $before;
|
||||
}
|
||||
$before = $booking_draft_items;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function findAfterDraftItemRelation($reid)
|
||||
{
|
||||
$next = false;
|
||||
foreach($this->booking_draft_items as $booking_draft_items) {
|
||||
if($next){
|
||||
return $booking_draft_items;
|
||||
}
|
||||
if ($booking_draft_items->id == $reid) {
|
||||
$next = true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStartDateFormat(){
|
||||
if(!$this->attributes['start_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['start_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getEndDateFormat(){
|
||||
if(!$this->attributes['end_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['end_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelBooking
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelCategory
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelCompany
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ use Illuminate\Support\Str;
|
|||
* @property array|null $contact_lands
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactLands($value)
|
||||
* @property-read int|null $travel_nationality_requirements_count
|
||||
* @property array|null $contact_emails
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactEmails($value)
|
||||
*/
|
||||
class TravelCountry extends Model
|
||||
{
|
||||
|
|
@ -81,13 +83,14 @@ class TravelCountry extends Model
|
|||
'contact_text_4',
|
||||
'contact_footer',
|
||||
'entry_requirements',
|
||||
'contact_emails',
|
||||
'is_customer_country',
|
||||
'active_frontend',
|
||||
'active_backend'
|
||||
|
||||
];
|
||||
|
||||
protected $casts = ['contact_lands' => 'array'];
|
||||
protected $casts = ['contact_lands' => 'array', 'contact_emails' => 'array'];
|
||||
|
||||
|
||||
public $timestamps = false;
|
||||
|
|
@ -115,6 +118,26 @@ class TravelCountry extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getContactEmailsStr($glue=PHP_EOL){
|
||||
if(isset($this->contact_emails)){
|
||||
return implode($glue, $this->contact_emails);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getContactLandsArray(){
|
||||
$ret = [];
|
||||
if($this->contact_lands){
|
||||
foreach ($this->contact_lands as $contact_land_id){
|
||||
$travel_country = TravelCountry::where('crm_id', $contact_land_id)->first();
|
||||
if($travel_country){
|
||||
$ret[] = $travel_country->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getNationalityRequirement($travel_nationality_id){
|
||||
|
||||
$model = TravelNationalityRequirement::where('travel_country_id', $this->id)->where('travel_nationality_id', $travel_nationality_id)->first();
|
||||
|
|
|
|||
65
app/Models/TravelInsurance.php
Normal file
65
app/Models/TravelInsurance.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelInsurance
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $booking_id
|
||||
* @property string $policy_number
|
||||
* @property string $ak
|
||||
* @property string $an
|
||||
* @property string $akt
|
||||
* @property float $premium
|
||||
* @property string $request_data
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Booking $booking
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAk($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAkt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAn($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereBookingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance wherePolicyNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance wherePremium($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereRequestData($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelInsurance extends Model
|
||||
{
|
||||
protected $table = 'travel_insurance';
|
||||
|
||||
protected $casts = [
|
||||
'booking_id' => 'int',
|
||||
'premium' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'booking_id',
|
||||
'policy_number',
|
||||
'ak',
|
||||
'an',
|
||||
'akt',
|
||||
'premium',
|
||||
'request_data'
|
||||
];
|
||||
|
||||
public function booking()
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Website
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use Util;
|
|||
use Validator;
|
||||
|
||||
|
||||
class FileRepository extends BaseRepository {
|
||||
class CustomerFileRepository extends BaseRepository {
|
||||
|
||||
|
||||
protected $rules;
|
||||
|
|
@ -3,11 +3,12 @@
|
|||
namespace App\Repositories;
|
||||
|
||||
|
||||
use App\Mail\MailSendFeWoService;
|
||||
use App\Mail\MailSendInfo;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Booking;
|
||||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
|
@ -26,6 +27,8 @@ class CustomerMailRepository extends BaseRepository {
|
|||
}
|
||||
|
||||
public function sendAndStore($data){
|
||||
//send or draft
|
||||
//$data['action']
|
||||
if(isset($data['send_mail_to']) && is_array($data['send_mail_to'])) {
|
||||
//has Attachments
|
||||
$customer_files = [];
|
||||
|
|
@ -36,20 +39,27 @@ class CustomerMailRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data['send_mail_to'] as $booking_id => $on) {
|
||||
$booking = Booking::find($booking_id);
|
||||
if ($booking->customer) {
|
||||
$message = $this->prepareContent($booking, $data['message']);
|
||||
$subject = $this->prepareContent($booking, $data['subject']);
|
||||
$reply_id = isset($data['customer_mail_id']) ? $data['customer_mail_id'] : NULL;
|
||||
$customer_mail = $this->store($booking, $subject, $message, $booking->customer->email, false, $reply_id);
|
||||
$this->sendMail($customer_mail, $customer_files);
|
||||
foreach ($customer_files as $file) {
|
||||
$file->customer_id = $booking->customer_id;
|
||||
$file->customer_mail_id = $customer_mail->id;
|
||||
$file->save();
|
||||
$data['draft'] = (isset($data['action']) && $data['action'] === 'draft' ? true : false);
|
||||
if(!$data['draft']){
|
||||
$data['message'] = $this->prepareContent($booking, $data['message']);
|
||||
$data['subject'] = $this->prepareContent($booking, $data['subject']);
|
||||
}
|
||||
$reply_id = isset($data['customer_mail_id']) ? $data['customer_mail_id'] : NULL;
|
||||
$email = isset($data['send_mail_to_mail'][$booking_id]) ? $data['send_mail_to_mail'][$booking_id] : $booking->customer->email;
|
||||
$customer_mail = $this->store($booking, $data, $email, false, $reply_id);
|
||||
foreach ($customer_files as $file) {
|
||||
$file->customer_id = $booking->customer_id;
|
||||
$file->customer_mail_id = $customer_mail->id;
|
||||
$file->save();
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] === 'send'){ //not at draft
|
||||
$this->sendMail($customer_mail);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,10 +77,11 @@ class CustomerMailRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
if ($booking->customer) {
|
||||
$data['draft'] = (isset($data['action']) && $data['action'] === 'draft' ? true : false);
|
||||
$mail_from = isset($data['mail_from']) ? $data['mail_from'] : $booking->customer->email;
|
||||
$sent_at = isset($data['sent_at']) ? \Carbon::parse(str_replace("- ", "", $data['sent_at'])) : now();
|
||||
$reply_id = isset($data['customer_mail_id']) ? $data['customer_mail_id'] : NULL;
|
||||
$customer_mail = $this->store($booking, $data['subject'], $data['message'], $mail_from, true, $reply_id, $sent_at);
|
||||
$customer_mail = $this->store($booking, $data, $mail_from, true, $reply_id, $sent_at);
|
||||
foreach ($customer_files as $file) {
|
||||
$file->customer_id = $booking->customer_id;
|
||||
$file->customer_mail_id = $customer_mail->id;
|
||||
|
|
@ -81,26 +92,68 @@ class CustomerMailRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
|
||||
public function store($booking, $subject, $message, $mail_from, $is_answer = false, $reply_id = NULL, $sent_at=false){
|
||||
public function store($booking, $data, $mail_from, $is_answer = false, $reply_id = NULL, $sent_at=false){
|
||||
|
||||
$data['travel_country_id'] = isset($data['travel_country_id']) && $data['travel_country_id']>0 ? $data['travel_country_id'] : NULL;
|
||||
if(isset($data['save_customer_mail_id'])){
|
||||
$customer_mail = CustomerMail::find($data['save_customer_mail_id']);
|
||||
$customer_mail->fill([
|
||||
'booking_id' => $booking->id,
|
||||
'customer_id' => $booking->customer_id,
|
||||
'lead_id' => $booking->lead_id,
|
||||
'is_answer' => $is_answer,
|
||||
'reply_id' => $reply_id,
|
||||
'email' => $mail_from,
|
||||
'recipient' => isset($data['recipient']) ? Util::_explodeLines($data['recipient']) : null,
|
||||
'cc' => isset($data['cc']) ? Util::_explodeLines($data['cc']) : null,
|
||||
'bcc' => isset($data['bcc']) ? Util::_explodeLines($data['bcc']) : null,
|
||||
'subject' => $data['subject'],
|
||||
'message' => $data['message'],
|
||||
'dir' => isset($data['dir']) ? $data['dir'] : 0,
|
||||
'travel_country_id' => $data['travel_country_id'],
|
||||
'draft' => $data['draft'],
|
||||
'sent_at' => $sent_at ? $sent_at : now(),
|
||||
])->save();
|
||||
}else{
|
||||
$customer_mail = CustomerMail::create([
|
||||
'booking_id' => $booking->id,
|
||||
'customer_id' => $booking->customer_id,
|
||||
'lead_id' => $booking->lead_id,
|
||||
'is_answer' => $is_answer,
|
||||
'reply_id' => $reply_id,
|
||||
'email' => $mail_from,
|
||||
'recipient' => isset($data['recipient']) ? Util::_explodeLines($data['recipient']) : null,
|
||||
'cc' => isset($data['cc']) ? Util::_explodeLines($data['cc']) : null,
|
||||
'bcc' => isset($data['bcc']) ? Util::_explodeLines($data['bcc']) : null,
|
||||
'subject' => $data['subject'],
|
||||
'message' => $data['message'],
|
||||
'dir' => isset($data['dir']) ? $data['dir'] : 0,
|
||||
'travel_country_id' => $data['travel_country_id'],
|
||||
'draft' => $data['draft'],
|
||||
'sent_at' => $sent_at ? $sent_at : now(),
|
||||
]);
|
||||
}
|
||||
|
||||
$customer_mail = CustomerMail::create([
|
||||
'booking_id' => $booking->id,
|
||||
'customer_id' => $booking->customer_id,
|
||||
'lead_id' => $booking->lead_id,
|
||||
'is_answer' => $is_answer,
|
||||
'reply_id' => $reply_id,
|
||||
'email' => $mail_from,
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'sent_at' => $sent_at ? $sent_at : now(),
|
||||
]);
|
||||
return $customer_mail;
|
||||
}
|
||||
|
||||
private function sendMail($customer_mail, $customer_files){
|
||||
|
||||
try{
|
||||
Mail::to($customer_mail->email)->send(new MailSendInfo($customer_mail->subject, $customer_mail->message, $customer_files));
|
||||
private function sendMail($customer_mail){
|
||||
$to_mails = [];
|
||||
if(strpos($customer_mail->email, ',')){
|
||||
$to_mails = array_map('trim', explode(',', $customer_mail->email));
|
||||
}else{
|
||||
$to_mails[] = $customer_mail->email;
|
||||
}
|
||||
if($customer_mail->recipient){
|
||||
$to_mails = array_merge($to_mails, $customer_mail->recipient);
|
||||
}
|
||||
$customer_files = $customer_mail->customer_files;
|
||||
try {
|
||||
//
|
||||
Mail::to($to_mails)
|
||||
->cc($customer_mail->cc ?: [])
|
||||
->bcc($customer_mail->bcc ?: [])
|
||||
->send(new MailSendInfo($customer_mail->subject, $customer_mail->message, $customer_files));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
// Never reached
|
||||
|
|
@ -124,48 +177,65 @@ class CustomerMailRepository extends BaseRepository {
|
|||
$country = $booking->travel_country_id ? $booking->travel_country->name : "-";
|
||||
$program = $booking->travelagenda_id ? $booking->travel_agenda->name : "-";
|
||||
$salutation = $booking->customer->salutation->name;
|
||||
$start_date = $booking->getStartDateFormat();
|
||||
$end_date = $booking->getEndDateFormat();
|
||||
$booking_date = $booking->getBookingDateFormat();
|
||||
$airline = $booking->airline ? $booking->airline->name_full : '-';
|
||||
|
||||
$dear = $booking->customer->salutation_id == 1 ? 'geehrter' : 'geehrte';
|
||||
$search = ['#geehrte/r#', '#Anrede#', '#Vorname#', '#Nachname#', '#Reiseland#', '#Programm#'];
|
||||
$replace = [$dear, $salutation, $first_name, $last_name, $country, $program, $salutation];
|
||||
$search = ['#geehrte/r#', '#Anrede#', '#Vorname#', '#Nachname#', '#Reiseland#', '#Programm#', '#Anreisedatum#', '#Abreisedatum#', '#Buchungsdatum#', '#Airline#'];
|
||||
$replace = [$dear, $salutation, $first_name, $last_name, $country, $program, $start_date, $end_date, $booking_date, $airline];
|
||||
$content = str_replace($search, $replace, $content);
|
||||
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
private static function prepareContactMails($value){
|
||||
|
||||
if(isset($value->customers) && $value->customer_mail_dir > 0){
|
||||
$first_mail = "";
|
||||
if($value->customer_mail_dir == 1 && $value->customer_mail_country > 0){
|
||||
//Agentur / Land
|
||||
$travel_country = \App\Models\Sym\TravelCountry::find($value->customer_mail_country);
|
||||
if($travel_country && $travel_country->contact_emails && count($travel_country->contact_emails) > 0){
|
||||
$contact_emails = $travel_country->contact_emails;
|
||||
$first_mail = array_shift($contact_emails);
|
||||
if(count($contact_emails) > 0){
|
||||
$value->recipient = Util::_implodeLines($contact_emails);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($value->customer_mail_dir == 2){
|
||||
//Airline
|
||||
$airline = Airline::whereName('Xemail')->first();
|
||||
if($airline && $airline->contact_emails && count($airline->contact_emails) > 0){
|
||||
$contact_emails = $airline->contact_emails;
|
||||
$first_mail = array_shift($contact_emails);
|
||||
if(count($contact_emails) > 0){
|
||||
$value->recipient = Util::_implodeLines($contact_emails);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($value->customers as $key=>$val){
|
||||
$val['email'] = $first_mail;
|
||||
$value->customers[$key] = $val;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public static function loadModal($data)
|
||||
{
|
||||
|
||||
$value = new Collection();
|
||||
$value->title = "";
|
||||
$value->subtitle = "";
|
||||
$value->url = "";
|
||||
if ($data['action'] === "new-customer-mail") {
|
||||
if (isset($data['booking_id'])) {
|
||||
$value->id = $data['booking_id'];
|
||||
$value->customers = $data['customers'];
|
||||
$value->subject = "";
|
||||
$value->message = "Sehr #geehrte/r# #Anrede# #Vorname# #Nachname#,\n\nText ....";
|
||||
$value->s_placeholder = "Betreff der E-Mail";
|
||||
$value->m_placeholder = "Nachricht der E-Mail";
|
||||
|
||||
if(isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])){
|
||||
$value->subject = "Re: ".$customer_mail->subject;
|
||||
$value->customer_mail = $customer_mail;
|
||||
}
|
||||
|
||||
$value->title = "E-Mail- Nachricht an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet.";
|
||||
if($data['id'] === 'reply-send'){
|
||||
$value->title = "E-Mail Antwort an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet, die im System als Antwort gespeichert wird.";
|
||||
}
|
||||
$value->url = $data['url'];
|
||||
return view("customer.mail.modal-new-mail", compact('data', 'value'))->render();
|
||||
}
|
||||
}
|
||||
|
||||
$value->recipient = "";
|
||||
$value->cc = "";
|
||||
$value->bcc = "";
|
||||
/*Ansicht*/
|
||||
if ($data['action'] === "show-customer-mail") {
|
||||
if (isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])) {
|
||||
$value->url = $data['url'];
|
||||
|
|
@ -173,17 +243,96 @@ class CustomerMailRepository extends BaseRepository {
|
|||
return view("customer.mail.modal-show-mail", compact('data', 'value', 'customer_mail'))->render();
|
||||
}
|
||||
}
|
||||
/* neue Mail */
|
||||
if ($data['action'] === "edit-customer-mail") {
|
||||
$value->id = $data['id']; //
|
||||
$customer_mail = CustomerMail::find($value->id);
|
||||
$booking = $customer_mail->booking;
|
||||
$value->customer_files = $customer_mail->customer_files;
|
||||
$value->save_customer_mail_id = $customer_mail->id;
|
||||
$value->draft = true;
|
||||
$value->id = $customer_mail->booking_id;
|
||||
$value->booking = $booking;
|
||||
$value->show = 'single';
|
||||
|
||||
$tmp = [];
|
||||
$tmp['email'] = $customer_mail->email ? $customer_mail->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;
|
||||
$value->customers = $data['customers'];
|
||||
$value->subject = $customer_mail->subject;
|
||||
$value->message = $customer_mail->message;
|
||||
$value->recipient = Util::_implodeLines($customer_mail->recipient);
|
||||
$value->cc = Util::_implodeLines($customer_mail->cc);
|
||||
$value->bcc = Util::_implodeLines($customer_mail->bcc);
|
||||
|
||||
$value->title = "E-Mail- Nachricht an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet.";
|
||||
if($customer_mail->reply_id){
|
||||
$value->title = "E-Mail Antwort an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet, die im System als Antwort gespeichert wird.";
|
||||
}
|
||||
$value->s_placeholder = "Betreff der E-Mail";
|
||||
$value->m_placeholder = "Nachricht der E-Mail";
|
||||
$value->url = $data['url'];
|
||||
$value->customer_mail_dir = $customer_mail->dir ? $customer_mail->dir : 0;
|
||||
$value->customer_mail_country = $customer_mail->travel_country_id ? $customer_mail->travel_country_id : 0;
|
||||
|
||||
return view("customer.mail.modal-new-mail", compact('data', 'value'))->render();
|
||||
|
||||
}
|
||||
/* neue Mail */
|
||||
if ($data['action'] === "new-customer-mail") {
|
||||
$value->id = "";
|
||||
$value->draft = false;
|
||||
//singel
|
||||
if (isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])) {
|
||||
$value->id = $data['booking_id'];
|
||||
$value->booking = $booking;
|
||||
$value->show = 'single';
|
||||
$value->draft = true;
|
||||
}else{
|
||||
//multi
|
||||
$value->show = 'multi';
|
||||
}
|
||||
$value->customers = $data['customers'];
|
||||
$value->subject = "";
|
||||
$value->message = "<p>Sehr #geehrte/r# #Anrede# #Vorname# #Nachname#,</p><p>Text ...</p>";
|
||||
$value->s_placeholder = "Betreff der E-Mail";
|
||||
$value->m_placeholder = "Nachricht der E-Mail";
|
||||
if(isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])){
|
||||
$value->subject = "Re: ".Util::_first_replace($customer_mail->subject);
|
||||
$value->customer_mail = $customer_mail;
|
||||
}
|
||||
|
||||
$value->title = "E-Mail- Nachricht an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet.";
|
||||
if($data['id'] === 'reply-send'){
|
||||
$value->title = "E-Mail Antwort an Kunden senden";
|
||||
$value->subtitle = "Dem Kunden wird eine E-Mail zugesendet, die im System als Antwort gespeichert wird.";
|
||||
}
|
||||
$value->url = $data['url'];
|
||||
$value->customer_mail_dir = isset($data['customer_mail_dir']) ? $data['customer_mail_dir'] : 0;
|
||||
$value->customer_mail_country = isset($data['customer_mail_country']) ? $data['customer_mail_country'] : 0;
|
||||
|
||||
$value = self::prepareContactMails($value);
|
||||
return view("customer.mail.modal-new-mail", compact('data', 'value'))->render();
|
||||
|
||||
}
|
||||
/*Antwort speichern*/
|
||||
if ($data['action'] === "reply-customer-mail") {
|
||||
if (isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])) {
|
||||
$value->id = $data['booking_id'];
|
||||
$value->draft = false;
|
||||
$value->booking = $booking;
|
||||
$value->message = "";
|
||||
$value->subject = "";
|
||||
$value->s_placeholder = "Betreff des Kunden";
|
||||
$value->m_placeholder = "Nachricht des Kunden";
|
||||
if(isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])){
|
||||
$value->subject = "Re: ".$customer_mail->subject;
|
||||
$value->subject = "Re: ".Util::_first_replace($customer_mail->subject);
|
||||
$value->customer_mail = $customer_mail;
|
||||
}
|
||||
$value->title = "E-Mail Antwort speichern";
|
||||
|
|
@ -193,7 +342,11 @@ class CustomerMailRepository extends BaseRepository {
|
|||
|
||||
}
|
||||
$value->url = $data['url'];
|
||||
$value->show = 'reply';
|
||||
$value->customer_mail_dir = isset($data['customer_mail_dir']) ? $data['customer_mail_dir'] : 0;
|
||||
$value->customer_mail_country = isset($data['customer_mail_country']) ? $data['customer_mail_country'] : 0;
|
||||
|
||||
$value = self::prepareContactMails($value);
|
||||
return view("customer.mail.modal-new-mail", compact('data', 'value'))->render();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -515,5 +515,74 @@ class DraftRepository extends BaseRepository {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function change_dates_drafts_from_booking($new_start_date)
|
||||
{
|
||||
$booking = $this->model;
|
||||
$start_date = $booking->start_date;
|
||||
$_start_date = $booking->start_date;
|
||||
$_end_date = $booking->end_date;
|
||||
$new_start_date = Carbon::parse($new_start_date);
|
||||
//$duration = $booking->start_date->diffInDays($booking->end_date, false);
|
||||
$diff_days = $booking->start_date->diffInDays($new_start_date, false);
|
||||
|
||||
//new start date booking
|
||||
$_start_date->modify($diff_days.' days');
|
||||
//new end date booking
|
||||
$_end_date->modify($diff_days.' days');
|
||||
|
||||
/*dump($diff_days);
|
||||
dump($_start_date);
|
||||
dump($_end_date);
|
||||
*/
|
||||
|
||||
if($booking->booking_draft_items){
|
||||
foreach ($booking->booking_draft_items as $booking_draft_item){
|
||||
|
||||
/* dump($booking_draft_item->id);
|
||||
$start_date_temp = null;
|
||||
$end_date_temp = null;
|
||||
if($booking_draft_item->draft_item){
|
||||
if($booking_draft_item->draft_item->days_start > 0){
|
||||
$start_date_temp = clone $start_date;
|
||||
$start_date_temp->addDay($booking_draft_item->draft_item->days_start-1+$diff_days);
|
||||
dump($start_date_temp->format("d.m.Y"));
|
||||
}
|
||||
|
||||
if($booking_draft_item->draft_item->days_duration > 0){
|
||||
$end_date_temp = clone $start_date;
|
||||
$end_date_temp->addDay($booking_draft_item->draft_item->days_duration-1+$diff_days);
|
||||
dump($end_date_temp->format("d.m.Y"));
|
||||
}
|
||||
}*/
|
||||
|
||||
$d_start_date = null;
|
||||
$d_end_date = null;
|
||||
if($d_start_date = $booking_draft_item->getStartDateRow()){
|
||||
$d_start_date->modify($diff_days.' days');
|
||||
//dump($d_start_date->format('d.m.Y'));
|
||||
$booking_draft_item->setStartDateRow($d_start_date->format('Y-m-d'));
|
||||
}
|
||||
if($d_end_date = $booking_draft_item->getEndDateRow()){
|
||||
$d_end_date->modify($diff_days.' days');
|
||||
//sdump($d_end_date->format('d.m.Y'));
|
||||
$booking_draft_item->setEndDateRow($d_end_date->format('Y-m-d'));
|
||||
}
|
||||
|
||||
/*if($start_date_temp != null && $start_date_temp == $d_start_date){
|
||||
dump(true);
|
||||
}
|
||||
if($end_date_temp != null && $end_date_temp == $d_end_date){
|
||||
dump(true);
|
||||
}*/
|
||||
$booking_draft_item->save();
|
||||
}
|
||||
}
|
||||
if(!$booking->origin_start_date){
|
||||
$booking->origin_start_date = $booking->start_date;
|
||||
}
|
||||
$booking->start_date = $_start_date;
|
||||
$booking->end_date = $_end_date;
|
||||
$booking->save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
175
app/Services/CreateCouponPDF.php
Normal file
175
app/Services/CreateCouponPDF.php
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Libraries\CouponPDF;
|
||||
use App\Models\Coupon;
|
||||
|
||||
class CreateCouponPDF {
|
||||
|
||||
protected $pdfRenderer;
|
||||
protected $coupon;
|
||||
protected $styles = array();
|
||||
protected $pdf;
|
||||
|
||||
|
||||
public function __construct(Coupon $coupon)
|
||||
{
|
||||
$this->coupon = $coupon;
|
||||
}
|
||||
|
||||
public function create(){
|
||||
|
||||
// initiate FPDI
|
||||
$pdf = new CouponPDF();
|
||||
if($this->coupon->text == NULL && $this->coupon->value == 50.00){
|
||||
$is_static_coupon = true;
|
||||
|
||||
$pdf->_set('is_static_coupon', true);
|
||||
}else{
|
||||
$is_static_coupon = false;
|
||||
$pdf->_set('is_static_coupon', false);
|
||||
}
|
||||
|
||||
$pdf->AddFont('Helvetica', '', 'helvetica.php');
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
if ($this->coupon->isLegal()) {
|
||||
$pdf->SetXY(20, 90);
|
||||
$pdf->SetTextColor(230, 10, 10);
|
||||
$pdf->SetFont('Helvetica', 'B', 28);
|
||||
$pdf->Cell(80, 20, utf8_decode('Der Gutschein ist nicht mehr gültig!'), 0, 0, 'L');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!$is_static_coupon){
|
||||
$pdf->SetXY(30, 55);
|
||||
$pdf->SetTextColor(16, 77, 140);
|
||||
$pdf->SetFont('Helvetica', 'B', 50);
|
||||
$pdf->Cell(80, 20, Util::_number_format($this->coupon->value), 0, 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(16, 77, 140);
|
||||
$pdf->SetFillColor(16, 77, 140);
|
||||
$pdf->SetLineWidth(0.4);
|
||||
$pdf->Rect(126, 31, 74, 20, 'DF');
|
||||
|
||||
$pdf->SetTextColor(255,255,255);
|
||||
$x = 128;
|
||||
$y = 32;
|
||||
$border = 0;
|
||||
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, "Nummer:", $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, $this->coupon->number, $border, 0, 'R');
|
||||
$y += 6;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, utf8_decode('Gültig vom:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, Util::_format_date($this->coupon->issue_date), $border, 0, 'R');
|
||||
$y += 6;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, utf8_decode('Gültig bis:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, Util::_format_date($this->coupon->valid_date), $border, 0, 'R');
|
||||
|
||||
|
||||
//$pdf->SetDrawColor(16, 77, 140);
|
||||
$pdf->SetFillColor(16, 77, 140);
|
||||
$pdf->Rect(126, 56, 74, 7.5, 'DF');
|
||||
$pdf->Rect(126, 56, 74, 35, 'D');
|
||||
|
||||
$x = 128;
|
||||
$y = 56;
|
||||
$pdf->SetXY($x, $y);
|
||||
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(40, 7.5, utf8_decode('Ausgestellt für:'), $border, 0, 'L');
|
||||
|
||||
$pdf->SetTextColor(16, 77, 140);
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
|
||||
$customerName = ($this->coupon->customer && $this->coupon->customer->salutation ? $this->coupon->customer->salutation->name . ' ' : '' )
|
||||
. ($this->coupon->customer->title ? $$this->coupon->customer->title . ' ' : '' )
|
||||
. $this->coupon->customer->fullName();
|
||||
$customerStreet = $this->coupon->customer ? $this->coupon->customer->street : '';
|
||||
$customerRegion = $this->coupon->customer->zip ? $this->coupon->customer->zip." " : '';
|
||||
$customerRegion .= $this->coupon->customer->city ? $this->coupon->customer->city : '';
|
||||
|
||||
$y += 12;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerName), $border, 0, 'L');
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerStreet), $border, 0, 'L');
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerRegion), $border, 0, 'L');
|
||||
|
||||
$x = 128;
|
||||
$y = 106;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
|
||||
$sender = 'STERN TOURS GmbH'."\n".
|
||||
'Emser Straße 3'."\n".
|
||||
'10719 Berlin'."\n\n".
|
||||
'Fon: +49 (0) 30 700 9410 0'."\n".
|
||||
'Fax: +49 (0) 30 700 9410 44'."\n".
|
||||
'e-Mail: stern@sterntours.de'."\n".
|
||||
'Internet: www.sterntours.de'."\n";
|
||||
$pdf->MultiCell(70, 5.5, utf8_decode($sender), $border, 'L');
|
||||
|
||||
|
||||
if($is_static_coupon) {
|
||||
$x = 12;
|
||||
$y = 155.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(130, 5.5, utf8_decode('Gutscheinbedingungen:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 7);
|
||||
$terms = '- gültig bei Pauschalreisen, Last Minute & More, Hotel und Ferienhäuser'."\n".
|
||||
'- nur Einlösbar bei Buchungen mit einem Gesamtreisepreis von mind. Euro 750,-'."\n".
|
||||
'- Der Gutscheinbetrag wird Ihnen nach Reiseantritt der nächsten Reise per'."\n".
|
||||
' Banküberweisung zugestellt'."\n".
|
||||
'- der Reise-Gutschein kann bis einen Tag vor Abreise eingelöst werden'."\n".
|
||||
'- pro Buchung kann nur ein Reise-Gutschein eingelöst werden'."\n".
|
||||
'- der Reise-Gutschein kann nicht auf Stornokosten angerechnet werden'."\n".
|
||||
'- bei Stornierung der Reise wird der Reise-Gutschein ungültig und nicht ausgezahlt'."\n".
|
||||
'- der Reise-Gutschein ist nicht übertragbar'."\n";
|
||||
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->MultiCell(130, 3.5, utf8_decode($terms), $border, 'L');
|
||||
|
||||
}else{
|
||||
$x = 12;
|
||||
$y = 157;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', '', 9);
|
||||
if( $this->coupon->text !== ""){
|
||||
$text = $this->coupon->text;
|
||||
$text = preg_replace("/\r\n|\n|\r/", "\n", $text);
|
||||
|
||||
$pdf->MultiCell(180, 4.2, utf8_decode($text), 0, 'L');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$this->pdf = $pdf;
|
||||
}
|
||||
|
||||
public function output($filename, $cd){
|
||||
if($cd){
|
||||
return $this->pdf->Output($filename, 'D');
|
||||
}
|
||||
return $this->pdf->Output();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -233,12 +233,10 @@ class HTMLHelper
|
|||
}
|
||||
|
||||
public static function getTravelCountriesOptions($countryId = false){
|
||||
|
||||
$checked = [];
|
||||
if($countryId){
|
||||
!is_array($countryId) ? $checked = array($countryId) : $checked = $countryId;
|
||||
}
|
||||
|
||||
$options = TravelCountry::where('active_backend',1)->get();
|
||||
$ret = '';
|
||||
foreach ($options as $option){
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
|
||||
|
||||
class Util
|
||||
{
|
||||
|
||||
|
||||
public static function formatDate(){
|
||||
if(\App::getLocale() == "en"){
|
||||
return 'yyyy-mm-dd';
|
||||
}
|
||||
return 'dd.mm.yyyy';
|
||||
|
||||
}
|
||||
|
||||
public static function formatDateDB(){
|
||||
|
|
@ -42,6 +38,39 @@ class Util
|
|||
|
||||
}
|
||||
|
||||
public static function _number_format($value){
|
||||
return number_format(($value), 2, ',', '.');
|
||||
|
||||
}
|
||||
|
||||
public static function _first_replace($value, $search='re:', $replace=''){
|
||||
do {
|
||||
$before = strlen($value);
|
||||
$value = trim(preg_replace('/^'.$search.'/i', $replace, $value));
|
||||
|
||||
}while($before !== strlen($value));
|
||||
return $value;
|
||||
|
||||
}
|
||||
public static function _explodeLines($value = false){
|
||||
if($value){
|
||||
return explode('#', str_replace(array("\r\n", "\r", "\n"),"#", $value));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static function _implodeLines($value, $glue=PHP_EOL){
|
||||
if(is_array($value)){
|
||||
return implode($glue, $value);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getContactEmailsStr($glue=PHP_EOL){
|
||||
if(isset($this->contact_emails)){
|
||||
return implode($glue, $this->contact_emails);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static function _clean_float($value){
|
||||
|
||||
$groups = explode(".", preg_replace("/[^0-9.-]/", "", str_replace(',', '.', $value)));
|
||||
|
|
@ -74,9 +103,7 @@ class Util
|
|||
$clean;
|
||||
}
|
||||
|
||||
|
||||
public static function replacePlaceholders($search, $replace){
|
||||
|
||||
preg_match_all("/\{{(.+?)\}}/", $search, $matches);
|
||||
if (isset($matches[1]) && count($matches[1]) > 0){
|
||||
foreach ($matches[1] as $key => $value) {
|
||||
|
|
@ -89,11 +116,8 @@ class Util
|
|||
return $search;
|
||||
}
|
||||
|
||||
|
||||
public static function cleanHTML($html)
|
||||
{
|
||||
|
||||
|
||||
$html = str_replace('font-size: 14px;', ' ', $html);
|
||||
$html = str_replace('font-weight: lighter; ', ' ', $html);
|
||||
$html = str_replace('font-family: Helvetica, Arial, sans-serif; ', ' ', $html);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue