Mail and Booking

This commit is contained in:
Kevin Adametz 2020-04-15 12:11:42 +02:00
parent 62e84637b6
commit 5daea268f7
250 changed files with 5377 additions and 1473 deletions

View file

@ -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]));
}
}
}
}