File Controller, Booking Organisation, import Draft, old arrangements
This commit is contained in:
parent
4eb83def39
commit
8fd1f4d451
289 changed files with 36649 additions and 10877 deletions
|
|
@ -27,11 +27,10 @@ class BookingController extends Controller
|
|||
protected $custRepo;
|
||||
|
||||
public function __construct(BookingRepository $bookingRepo, CustomerRepository $custRepo)
|
||||
{
|
||||
{
|
||||
$this->middleware(['admin', '2fa']);
|
||||
$this->bookingRepo = $bookingRepo;
|
||||
$this->custRepo = $custRepo;
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
|
|
@ -45,11 +44,10 @@ class BookingController extends Controller
|
|||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
if ($id == "new") {
|
||||
$booking = new Booking();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$booking = Booking::findOrFail($id);
|
||||
$booking->getPassolutionPDF(true);
|
||||
$id = $booking->id;
|
||||
|
|
@ -60,70 +58,91 @@ class BookingController extends Controller
|
|||
'show_modal_quill_preview' => true,
|
||||
];
|
||||
return view('booking.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
// \Session()->flash('alert-save', '1');
|
||||
// \Session()->flash('alert-save', '1');
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if($id === "new") {
|
||||
if ($id === "new") {
|
||||
$booking = new Booking();
|
||||
}else{
|
||||
} else {
|
||||
$booking = Booking::findOrFail($id);
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === 'deleteAllChecked'){
|
||||
if(!isset($data['draft_item_delete']) || !$data['draft_item_delete']){
|
||||
if ($data['action'] === 'convertArrangementsToDrafts') {
|
||||
if (!$booking->arrangements || $booking->arrangements->count() == 0) {
|
||||
\Session()->flash('alert-warning', __('Keine Arrangements zum Konvertieren vorhanden'));
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
$this->bookingRepo->convertArrangementsToDrafts($booking);
|
||||
\Session()->flash('alert-success', __('Arrangements wurden erfolgreich in die neue Draft-Struktur übernommen'));
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
if ($data['action'] === 'loadDraftToBooking') {
|
||||
if (!isset($data['draft_id']) || !$data['draft_id']) {
|
||||
\Session()->flash('alert-error', __('Keine Vorlage ausgewählt'));
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
$this->bookingRepo->loadDraftToBooking($booking->id, $data['draft_id']);
|
||||
\Session()->flash('alert-success', __('Vorlage wurde erfolgreich geladen'));
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
if ($data['action'] === 'deleteAllChecked') {
|
||||
if (!isset($data['draft_item_delete']) || !$data['draft_item_delete']) {
|
||||
\Session()->flash('alert-error', 'Es wurden keine Leistungen ausgewählt');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
foreach ($data['draft_item_delete'] as $draft_item_delete_id => $v) {
|
||||
$booking_draft_item = BookingDraftItem::findOrFail($draft_item_delete_id);
|
||||
if($booking_draft_item->booking_id === $booking->id){
|
||||
if ($booking_draft_item->booking_id === $booking->id) {
|
||||
$booking_draft_item->delete();
|
||||
}
|
||||
}
|
||||
$booking->calculate_price_total();
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
if($data['action'] === 'save_notice'){
|
||||
if ($data['action'] === 'save_notice') {
|
||||
$booking = $this->bookingRepo->updateNotice($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingNotice");
|
||||
}
|
||||
if($data['action'] === 'edit_notice'){
|
||||
if ($data['action'] === 'edit_notice') {
|
||||
$booking = $this->bookingRepo->updateNotice($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingNotice");
|
||||
}
|
||||
if(strpos($data['action'], 'createPDF') !== false) {
|
||||
if (strpos($data['action'], 'createPDF') !== false) {
|
||||
$bookingPDF = new BookingPDFRepository($booking);
|
||||
$bookingPDF->createPDF($id, $data);
|
||||
\Session()->flash('alert-success', 'PDF Datei erstellt');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingFiles");
|
||||
}
|
||||
|
||||
$redirect = route('booking_detail', [$booking->id]);
|
||||
|
||||
$i= 1;
|
||||
if($data['action'] === 'addItemUp'){
|
||||
$i = 1;
|
||||
if ($data['action'] === 'addItemUp') {
|
||||
$travel_program_id = null;
|
||||
$request_date = null;
|
||||
$comfort = 0;
|
||||
if(count($booking->booking_draft_items)){
|
||||
if (count($booking->booking_draft_items)) {
|
||||
$first_booking_draft_item = $booking->booking_draft_items()->first();
|
||||
$travel_program_id = $first_booking_draft_item->travel_program_id;
|
||||
$request_date = $first_booking_draft_item->request_date;
|
||||
$comfort = $first_booking_draft_item->comfort;
|
||||
}
|
||||
$add_draft_items_up_number = isset($data['add_draft_items_up_number']) ? intval($data['add_draft_items_up_number']) : 1;
|
||||
for ($j=0; $j < $add_draft_items_up_number; $j++) {
|
||||
for ($j = 0; $j < $add_draft_items_up_number; $j++) {
|
||||
$booking->booking_draft_items()->create([
|
||||
'booking_id' => $booking->id,
|
||||
'travel_program_id' => $travel_program_id,
|
||||
|
|
@ -138,7 +157,7 @@ class BookingController extends Controller
|
|||
'end_date' => null,
|
||||
'service' => '',
|
||||
'price_adult' => null,
|
||||
'adult' => null ,
|
||||
'adult' => null,
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'price' => 0,
|
||||
|
|
@ -148,11 +167,11 @@ class BookingController extends Controller
|
|||
]);
|
||||
$i++;
|
||||
}
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
if(isset($data['draft_item'])){
|
||||
foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item){
|
||||
if (isset($data['draft_item'])) {
|
||||
foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item) {
|
||||
$BookingDraftItem = BookingDraftItem::findOrFail($booking_draft_item_id);
|
||||
$draft_item['price_adult'] = isset($draft_item['price_adult']) ? $draft_item['price_adult'] : null;
|
||||
$draft_item['adult'] = isset($draft_item['adult']) ? $draft_item['adult'] : null;
|
||||
|
|
@ -166,18 +185,18 @@ class BookingController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if($data['action'] === 'addItemDown'){
|
||||
if ($data['action'] === 'addItemDown') {
|
||||
$travel_program_id = null;
|
||||
$request_date = null;
|
||||
$comfort = 0;
|
||||
if(count($booking->booking_draft_items)){
|
||||
if (count($booking->booking_draft_items)) {
|
||||
$first_booking_draft_item = $booking->booking_draft_items()->first();
|
||||
$travel_program_id = $first_booking_draft_item->travel_program_id;
|
||||
$request_date = $first_booking_draft_item->request_date;
|
||||
$comfort = $first_booking_draft_item->comfort;
|
||||
}
|
||||
$add_draft_items_up_number = isset($data['add_draft_items_down_number']) ? intval($data['add_draft_items_down_number']) : 1;
|
||||
for ($j=0; $j < $add_draft_items_up_number; $j++) {
|
||||
for ($j = 0; $j < $add_draft_items_up_number; $j++) {
|
||||
$booking->booking_draft_items()->create([
|
||||
'booking_id' => $booking->id,
|
||||
'travel_program_id' => $travel_program_id,
|
||||
|
|
@ -192,7 +211,7 @@ class BookingController extends Controller
|
|||
'end_date' => null,
|
||||
'service' => '',
|
||||
'price_adult' => null,
|
||||
'adult' => null ,
|
||||
'adult' => null,
|
||||
'price_children' => 0,
|
||||
'children' => 0,
|
||||
'price' => 0,
|
||||
|
|
@ -202,14 +221,15 @@ class BookingController extends Controller
|
|||
]);
|
||||
$i++;
|
||||
}
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === 'saveCustomer' || $data['action'] === 'saveAll' || $data['action'] === 'save_lead_status' || $data['action'] === 'update_booking' ||
|
||||
$data['action'] === 'update_booking_services' || $data['action'] === 'update_booking_number' || $data['action'] === 'update_booking_price' ||
|
||||
$data['action'] === 'update_service_provider_entry' || $data['action'] === 'update_booking_service_item' || $data['action'] === 'update_booking_participant'){
|
||||
if (
|
||||
$data['action'] === 'saveCustomer' || $data['action'] === 'saveAll' || $data['action'] === 'save_lead_status' || $data['action'] === 'update_booking' ||
|
||||
$data['action'] === 'update_booking_services' || $data['action'] === 'update_booking_number' || $data['action'] === 'update_booking_price' ||
|
||||
$data['action'] === 'update_service_provider_entry' || $data['action'] === 'update_booking_service_item' || $data['action'] === 'update_booking_participant'
|
||||
) {
|
||||
$customer = $this->custRepo->updateCustomerFromBooking($id, $data);
|
||||
$booking = $this->bookingRepo->updateLeadStatus($id, $data);
|
||||
$booking = $this->bookingRepo->updateBooking($id, $data);
|
||||
|
|
@ -222,49 +242,49 @@ class BookingController extends Controller
|
|||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
|
||||
|
||||
switch($data['action']){
|
||||
|
||||
switch ($data['action']) {
|
||||
case 'saveCustomer':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingCustomer");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingCustomer");
|
||||
break;
|
||||
case 'saveAll':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
case 'saveAll':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
break;
|
||||
case 'update_booking':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingBooking");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingBooking");
|
||||
break;
|
||||
case 'save_lead_status':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingLead");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingLead");
|
||||
break;
|
||||
case 'update_booking_services':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingServices");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingServices");
|
||||
break;
|
||||
case 'update_booking_number':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingMyJack");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingMyJack");
|
||||
break;
|
||||
case 'update_booking_price':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingPrice");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingPrice");
|
||||
break;
|
||||
case 'update_service_provider_entry':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingProvider");
|
||||
break;
|
||||
case 'update_booking_service_item':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingCompany");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingCompany");
|
||||
break;
|
||||
case 'update_booking_participant':
|
||||
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingParticipant");
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingParticipant");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$booking->calculate_price_total();
|
||||
|
||||
if(strpos($data['action'], 'up_') !== false) {
|
||||
if (strpos($data['action'], 'up_') !== false) {
|
||||
$reId = intval(str_replace('up_', '', $data['action']));
|
||||
$d_from = BookingDraftItem::findOrFail($reId);
|
||||
$d_to = $booking->findBeforeDraftItemRelation($reId);
|
||||
if($d_to) {
|
||||
if ($d_to) {
|
||||
$t_pos = $d_from->pos;
|
||||
$d_from->pos = $d_to->pos;
|
||||
$d_to->pos = $t_pos;
|
||||
|
|
@ -272,11 +292,11 @@ class BookingController extends Controller
|
|||
$d_to->save();
|
||||
}
|
||||
}
|
||||
if(strpos($data['action'], 'down_') !== false) {
|
||||
if (strpos($data['action'], 'down_') !== false) {
|
||||
$reId = intval(str_replace('down_', '', $data['action']));
|
||||
$d_from = BookingDraftItem::findOrFail($reId);
|
||||
$d_to = $booking->findAfterDraftItemRelation($reId);
|
||||
if($d_to) {
|
||||
if ($d_to) {
|
||||
$t_pos = $d_from->pos;
|
||||
$d_from->pos = $d_to->pos;
|
||||
$d_to->pos = $t_pos;
|
||||
|
|
@ -288,11 +308,12 @@ class BookingController extends Controller
|
|||
return $redirect;
|
||||
}
|
||||
|
||||
public function loadModal(){
|
||||
public function loadModal()
|
||||
{
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()) {
|
||||
if ($data['action'] === "new-customer-mail" || $data['action'] === "reply-customer-mail" || $data['action'] === "show-customer-mail" || $data['action'] === "edit-customer-mail"){
|
||||
if (Request::ajax()) {
|
||||
if ($data['action'] === "new-customer-mail" || $data['action'] === "reply-customer-mail" || $data['action'] === "show-customer-mail" || $data['action'] === "edit-customer-mail") {
|
||||
$data['customers'] = [];
|
||||
if ($data['action'] === "new-customer-mail" && isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])) {
|
||||
$tmp = [];
|
||||
|
|
@ -305,120 +326,119 @@ class BookingController extends Controller
|
|||
$ret = CustomerMailRepository::loadModal($data);
|
||||
}
|
||||
|
||||
if($data['action'] === "modal-upload-booking-file") {
|
||||
if ($data['action'] === "modal-upload-booking-file") {
|
||||
$ret = view("booking.upload_modal", compact('data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === "edit_notice") {
|
||||
if ($data['action'] === "edit_notice") {
|
||||
$value = BookingNotice::findOrFail($data['id']);
|
||||
$ret = view("booking.edit_notice_modal", compact('data', 'value'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === "createPDF_Coupon") {
|
||||
if ($data['action'] === "createPDF_Coupon") {
|
||||
$booking = Booking::findOrFail($data['booking_id']);
|
||||
$data['has_coupon'] = $booking->hasDocument('coupon');
|
||||
$data['default_value'] = config('booking.coupon_default_value');
|
||||
$data['default_value'] = config('booking.coupon_default_value');
|
||||
$data['issue_date'] = date('d.m.Y');
|
||||
$data['valid_date'] = \Carbon::now()->addMonths(config('booking.coupon_valid_date_month'))->format('d.m.Y');
|
||||
$ret = view("booking.modal_create_coupon", compact('data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === "createPDF_Storno") {
|
||||
if ($data['action'] === "createPDF_Storno") {
|
||||
$booking = Booking::findOrFail($data['booking_id']);
|
||||
$data['price'] = $booking->price;
|
||||
if($data['has_storno'] = $booking->hasDocument('storno')){
|
||||
if ($data['has_storno'] = $booking->hasDocument('storno')) {
|
||||
$document_storno = $booking->getDocument('storno');
|
||||
$data['storno_date'] = \Carbon::parse($document_storno->data->storno_date)->format('d.m.Y');
|
||||
$data['storno_print'] = \Carbon::parse($document_storno->data->storno_print)->format('d.m.Y') ;
|
||||
$data['storno_print'] = \Carbon::parse($document_storno->data->storno_print)->format('d.m.Y');
|
||||
$data['storno_status_id'] = $document_storno->data->storno_status_id;
|
||||
$data['storno_level'] = $document_storno->data->storno_level;
|
||||
$data['storno_level_number'] = _number_format($document_storno->data->storno_level);
|
||||
$data['storno_total_price'] = '';
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$data['storno_date'] = date('d.m.Y');
|
||||
$data['storno_print'] = date('d.m.Y');
|
||||
$data['storno_status_id'] = null;
|
||||
$data['storno_level'] = 100;
|
||||
$data['storno_level'] = 100;
|
||||
$data['storno_level_number'] = '';
|
||||
$data['storno_total_price'] = '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$ret = view("booking.modal_create_storno", compact('data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === "upload-booking-file"){
|
||||
if($data['booking_id']){
|
||||
if ($data['action'] === "upload-booking-file") {
|
||||
if ($data['booking_id']) {
|
||||
$bookingFileRepo = new BookingFileRepository(new BookingFile());
|
||||
$bookingFileRepo->_set('disk', 'booking');
|
||||
$bookingFileRepo->_set('booking_id', $data['booking_id']);
|
||||
$bookingFileRepo->_set('dir', '/files/'.date('Y/m').'/');
|
||||
$bookingFileRepo->_set('dir', '/files/' . date('Y/m') . '/');
|
||||
$bookingFileRepo->_set('identifier', 'booking');
|
||||
return $bookingFileRepo->uploadFile(Request::all());
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
return response()->json(['response' => $data, 'html' => $ret]);
|
||||
}
|
||||
|
||||
public function draftItemDelete($id){
|
||||
|
||||
public function draftItemDelete($id)
|
||||
{
|
||||
$booking_draft_item = BookingDraftItem::findOrFail($id);
|
||||
$booking = $booking_draft_item->booking;
|
||||
$booking_draft_item->delete();
|
||||
$booking->calculate_price_total();
|
||||
\Session()->flash('alert-success', __('Eintrag gelöscht'));
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
public function action($action, $id=false){
|
||||
public function action($action, $id = false)
|
||||
{
|
||||
|
||||
if(!$booking = Booking::find($id)){
|
||||
if (!$booking = Booking::find($id)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
if($action === 'change_travel_dates'){
|
||||
$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])."#collapseBookingOrganisation");
|
||||
if ($action === 'change_travel_dates') {
|
||||
$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]) . "#collapseBookingOrganisation");
|
||||
}
|
||||
|
||||
if($action === 'service_provider_entry_add_discount'){
|
||||
$ServiceProvider = ServiceProvider::where('type', 'discount')->where('active',true)->first();
|
||||
if ($action === 'service_provider_entry_add_discount') {
|
||||
$ServiceProvider = ServiceProvider::where('type', 'discount')->where('active', true)->first();
|
||||
ServiceProviderEntry::create([
|
||||
'booking_id' => $booking->id,
|
||||
'service_provider_id' => $ServiceProvider->id,
|
||||
'type' => 'discount',
|
||||
]);
|
||||
\Session()->flash('alert-success', __('Leistungsträger neuer Rabatt hinzugefügt'));
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingProvider");
|
||||
}
|
||||
|
||||
if($action === 'service_provider_entry_add_payment'){
|
||||
$ServiceProvider = ServiceProvider::where('type', 'payment')->where('active',true)->first();
|
||||
if ($action === 'service_provider_entry_add_payment') {
|
||||
$ServiceProvider = ServiceProvider::where('type', 'payment')->where('active', true)->first();
|
||||
ServiceProviderEntry::create([
|
||||
'booking_id' => $booking->id,
|
||||
'service_provider_id' => $ServiceProvider->id,
|
||||
'type' => 'payment',
|
||||
]);
|
||||
\Session()->flash('alert-success', __('Leistungsträger neue Zahlung hinzugefügt'));
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingProvider");
|
||||
}
|
||||
|
||||
if($action === 'booking_service_item_add'){
|
||||
$TravelCompany = TravelCompany::where('active',true)->first();
|
||||
if ($action === 'booking_service_item_add') {
|
||||
$TravelCompany = TravelCompany::where('active', true)->first();
|
||||
BookingServiceItem::create([
|
||||
'booking_id' => $booking->id,
|
||||
'travel_company_id' => $TravelCompany->id,
|
||||
'travel_date' => now(),
|
||||
]);
|
||||
\Session()->flash('alert-success', __('Reiseveranstalter neue Leistung hinzugefügt'));
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingCompany");
|
||||
}
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingCompany");
|
||||
}
|
||||
|
||||
if($action === 'booking_participant_add'){
|
||||
if ($action === 'booking_participant_add') {
|
||||
Participant::create([
|
||||
'booking_id' => $booking->id,
|
||||
'nationality_id' => 1,
|
||||
|
|
@ -426,129 +446,129 @@ class BookingController extends Controller
|
|||
|
||||
]);
|
||||
\Session()->flash('alert-success', __('Neuen Teilnehmer hinzugefügt'));
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingParticipant");
|
||||
}
|
||||
|
||||
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingParticipant");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id, $del="booking"){
|
||||
public function delete($id, $del = "booking")
|
||||
{
|
||||
|
||||
if($del === 'booking_file'){
|
||||
if ($del === 'booking_file') {
|
||||
$booking_file = BookingFile::findOrFail($id);
|
||||
$booking = $booking_file->booking;
|
||||
$this->deleteBookingFile($booking_file);
|
||||
\Session()->flash('alert-success', 'Datei gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingFiles");
|
||||
}
|
||||
if($del === 'booking_notice'){
|
||||
if ($del === 'booking_notice') {
|
||||
$booking_notice = BookingNotice::findOrFail($id);
|
||||
$booking = $booking_notice->booking;
|
||||
$booking_notice->delete();
|
||||
\Session()->flash('alert-success', 'Notiz gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
|
||||
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingNotice");
|
||||
}
|
||||
|
||||
if($del === 'passolution_file'){
|
||||
|
||||
if ($del === 'passolution_file') {
|
||||
$booking = Booking::findOrFail($id);
|
||||
$booking->resyncPassolutionPDF();
|
||||
\Session()->flash('alert-success', 'Passolution erneuert');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles");
|
||||
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingFiles");
|
||||
}
|
||||
|
||||
if($del === 'service_provider_entry'){
|
||||
if ($del === 'service_provider_entry') {
|
||||
$ServiceProviderEntry = ServiceProviderEntry::findOrFail($id);
|
||||
$booking = $ServiceProviderEntry->booking;
|
||||
$ServiceProviderEntry->delete();
|
||||
\Session()->flash('alert-success', 'Leistungsträger gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
|
||||
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingProvider");
|
||||
}
|
||||
|
||||
if($del === 'booking_service_item'){
|
||||
if ($del === 'booking_service_item') {
|
||||
$BookingServiceItem = BookingServiceItem::findOrFail($id);
|
||||
$booking = $BookingServiceItem->booking;
|
||||
$BookingServiceItem->delete();
|
||||
\Session()->flash('alert-success', 'Reiseveranstalter gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingCompany");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingCompany");
|
||||
}
|
||||
|
||||
if($del === 'participant'){
|
||||
if ($del === 'participant') {
|
||||
$Participant = Participant::findOrFail($id);
|
||||
$booking = $Participant->booking;
|
||||
$Participant->delete();
|
||||
\Session()->flash('alert-success', 'Teilnehmer gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingParticipant");
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingParticipant");
|
||||
}
|
||||
|
||||
return redirect(route('requests'));
|
||||
}
|
||||
|
||||
|
||||
private function deleteBookingFile($booking_file){
|
||||
private function deleteBookingFile($booking_file)
|
||||
{
|
||||
$fileRepo = new BookingFileRepository($booking_file);
|
||||
$fileRepo->_set('disk', 'booking');
|
||||
$fileRepo->delete();
|
||||
$booking_file->delete();
|
||||
$booking_file->delete();
|
||||
}
|
||||
|
||||
private function deleteCustomerFile($customer_file){
|
||||
private function deleteCustomerFile($customer_file)
|
||||
{
|
||||
$fileRepo = new CustomerFileRepository($customer_file);
|
||||
$fileRepo->_set('disk', 'customer');
|
||||
$fileRepo->delete();
|
||||
$customer_file->delete();
|
||||
$customer_file->delete();
|
||||
}
|
||||
|
||||
private function deleteBookingDocument($booking_document){
|
||||
private function deleteBookingDocument($booking_document)
|
||||
{
|
||||
$booking_document->deleteFile();
|
||||
$booking_document->delete();
|
||||
$booking_document->delete();
|
||||
}
|
||||
|
||||
public function deleteComplete($id){
|
||||
public function deleteComplete($id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
|
||||
if($booking->booking_files){
|
||||
if ($booking->booking_files) {
|
||||
foreach ($booking->booking_files as $booking_file) {
|
||||
$this->deleteBookingFile($booking_file);
|
||||
}
|
||||
}
|
||||
|
||||
if($booking->booking_notices){
|
||||
if ($booking->booking_notices) {
|
||||
foreach ($booking->booking_notices as $booking_notice) {
|
||||
$booking_notice->delete();
|
||||
}
|
||||
}
|
||||
if($booking->service_provider_entries){
|
||||
if ($booking->service_provider_entries) {
|
||||
foreach ($booking->service_provider_entries as $service_provider_entry) {
|
||||
$service_provider_entry->delete();
|
||||
}
|
||||
}
|
||||
if($booking->booking_service_items){
|
||||
if ($booking->booking_service_items) {
|
||||
foreach ($booking->booking_service_items as $booking_service_item) {
|
||||
$booking_service_item->delete();
|
||||
}
|
||||
}
|
||||
|
||||
if($booking->booking_provider_services){
|
||||
if ($booking->booking_provider_services) {
|
||||
foreach ($booking->booking_provider_services as $booking_provider_service) {
|
||||
$booking_provider_service->delete();
|
||||
}
|
||||
}
|
||||
if($booking->booking_country_services){
|
||||
if ($booking->booking_country_services) {
|
||||
foreach ($booking->booking_country_services as $booking_country_service) {
|
||||
$booking_country_service->delete();
|
||||
}
|
||||
}
|
||||
if($booking->participants){
|
||||
if ($booking->participants) {
|
||||
foreach ($booking->participants as $participant) {
|
||||
$participant->delete();
|
||||
}
|
||||
}
|
||||
if($booking->customer_mails){
|
||||
if ($booking->customer_mails) {
|
||||
foreach ($booking->customer_mails_reverse as $customer_mail) {
|
||||
if($customer_mail->customer_files){
|
||||
if ($customer_mail->customer_files) {
|
||||
foreach ($customer_mail->customer_files as $customer_file) {
|
||||
$this->deleteCustomerFile($customer_file);
|
||||
}
|
||||
|
|
@ -556,18 +576,18 @@ class BookingController extends Controller
|
|||
$customer_mail->delete();
|
||||
}
|
||||
}
|
||||
if($booking->booking_documents){
|
||||
if ($booking->booking_documents) {
|
||||
foreach ($booking->booking_documents as $booking_document) {
|
||||
if($booking_document->identifier === 'coupon'){
|
||||
if ($booking_document->identifier === 'coupon') {
|
||||
//coupon set booking ID to null <- is need by the customer
|
||||
$booking_document->booking_id = null;
|
||||
$booking_document->save();
|
||||
}else{
|
||||
} else {
|
||||
$this->deleteBookingDocument($booking_document);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($booking->coupons){
|
||||
if ($booking->coupons) {
|
||||
foreach ($booking->coupons as $coupon) {
|
||||
//coupon set booking ID to null <- is need by the customer
|
||||
$coupon->booking_id = null;
|
||||
|
|
@ -578,7 +598,4 @@ class BookingController extends Controller
|
|||
\Session()->flash('alert-success', 'Buchung gelöscht');
|
||||
return redirect(route('requests'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,15 @@ class FileController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
|
||||
public function show($id = null, $disk = null, $do='file')
|
||||
public function show($id = null, $disk = null, $do = 'file')
|
||||
{
|
||||
$path = "";
|
||||
$filename = "";
|
||||
|
||||
switch ($disk){
|
||||
switch ($disk) {
|
||||
case 'customer':
|
||||
$file = \App\Models\CustomerFile::findOrFail($id);
|
||||
$filename = $file->original_name;
|
||||
|
|
@ -66,25 +64,33 @@ class FileController extends Controller
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (file_exists($path)) {
|
||||
|
||||
// Cache-Control Header für PDFs und andere Dateien, die sich häufig ändern
|
||||
$headers = [
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Pragma' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
];
|
||||
|
||||
switch ($do) {
|
||||
case 'file':
|
||||
return Response::file($path);
|
||||
return Response::file($path, $headers);
|
||||
break;
|
||||
case 'download':
|
||||
return Response::download($path, $filename);
|
||||
return Response::download($path, $filename, $headers);
|
||||
break;
|
||||
case 'url':
|
||||
return $path.$filename;
|
||||
return $path . $filename;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showExpert($type = null, $class = null, $year = null, $file = null, $do = null) {
|
||||
public function showExpert($type = null, $class = null, $year = null, $file = null, $do = null)
|
||||
{
|
||||
|
||||
/*if ($type == 'xls') {
|
||||
$path = storage_path("app/export/");
|
||||
|
|
@ -92,35 +98,39 @@ class FileController extends Controller
|
|||
}*/
|
||||
$path = "";
|
||||
$filename = "";
|
||||
$headers = [];
|
||||
$headers = [
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Pragma' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
];
|
||||
|
||||
if ($class === 'invoices' || $class === 'infos'){
|
||||
if ($class === 'invoices' || $class === 'infos') {
|
||||
$headers = [
|
||||
'Content-Type: application/pdf',
|
||||
'Pragma: no-cache',
|
||||
'Cache-Control: no-store,no-cache, must-revalidate, post-check=0, pre-check=0'
|
||||
];
|
||||
$dir = $year."/";
|
||||
$dir = $year . "/";
|
||||
$filename = $file;
|
||||
if ($type === 'fewo') {
|
||||
if(Storage::disk('fewo_invoices')->exists( $dir.$filename )){
|
||||
$path = Storage::disk('fewo_invoices')->path($dir.$filename);
|
||||
if (Storage::disk('fewo_invoices')->exists($dir . $filename)) {
|
||||
$path = Storage::disk('fewo_invoices')->path($dir . $filename);
|
||||
}
|
||||
}
|
||||
if ($type === 'fewo') {
|
||||
if(Storage::disk('fewo_infos')->exists( $dir.$filename )){
|
||||
$path = Storage::disk('fewo_infos')->path($dir.$filename);
|
||||
if (Storage::disk('fewo_infos')->exists($dir . $filename)) {
|
||||
$path = Storage::disk('fewo_infos')->path($dir . $filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path)) {
|
||||
if($do === "download"){
|
||||
if ($do === "download") {
|
||||
return Response::download($path, $filename, $headers);
|
||||
}
|
||||
if($do === "file"){
|
||||
if ($do === "file") {
|
||||
return Response::file($path, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ class TravelCompanyController extends Controller
|
|||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id === "new") {
|
||||
if ($id == "new") {
|
||||
$model = new TravelCompany();
|
||||
$id = 'new';
|
||||
$model->active = 1;
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompany::findOrFail($id);
|
||||
$id = $model->id;
|
||||
}
|
||||
|
|
@ -45,20 +45,21 @@ class TravelCompanyController extends Controller
|
|||
return view('settings.travel_company.detail', $data);
|
||||
}
|
||||
|
||||
public function update($id){
|
||||
public function update($id)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
if(isset($data['update-action'])){
|
||||
if($data['update-action'] === 'save-travel-company-service'){
|
||||
$data['active'] = true;//isset($data['active']) ? true : false;
|
||||
if (isset($data['update-action'])) {
|
||||
if ($data['update-action'] === 'save-travel-company-service') {
|
||||
$data['active'] = true; //isset($data['active']) ? true : false;
|
||||
$travel_company = TravelCompany::findOrFail($id);
|
||||
$data['travel_company_id'] = $travel_company->id;
|
||||
|
||||
if($data['travel_company_service_id'] === 'new'){
|
||||
if ($data['travel_company_service_id'] === 'new') {
|
||||
$model = TravelCompanyService::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompanyService::find($data['travel_company_service_id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -69,9 +70,9 @@ class TravelCompanyController extends Controller
|
|||
}
|
||||
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
if($id === "new"){
|
||||
if ($id === "new") {
|
||||
$model = TravelCompany::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompany::find($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -79,12 +80,12 @@ class TravelCompanyController extends Controller
|
|||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_company_detail', [$model->id, $data['action']]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id, $del="travel_company"){
|
||||
public function delete($id, $del = "travel_company")
|
||||
{
|
||||
|
||||
if($del === 'travel_country') {
|
||||
if ($del === 'travel_country') {
|
||||
abort(404, 'Noch keine Funktion');
|
||||
$model = TravelCompany::findOrFail($id);
|
||||
$model->delete();
|
||||
|
|
@ -92,11 +93,11 @@ class TravelCompanyController extends Controller
|
|||
return redirect()->back();
|
||||
}
|
||||
|
||||
if($del === 'company_service'){
|
||||
if ($del === 'company_service') {
|
||||
$service = TravelCompanyService::findOrFail($id);
|
||||
$travel_company = $service->travel_company;
|
||||
//check as entry
|
||||
if($service->booking_company_services->count() > 0){
|
||||
if ($service->booking_company_services->count() > 0) {
|
||||
\Session()->flash('alert-error', 'Die Leistung kann nicht gelöscht werden, diese hat Einträge bei den Buchungen');
|
||||
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
|
||||
}
|
||||
|
|
@ -105,7 +106,4 @@ class TravelCompanyController extends Controller
|
|||
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ class TravelCountryController extends Controller
|
|||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id === "new") {
|
||||
if ($id == "new") {
|
||||
$model = new TravelCountry();
|
||||
$id = 'new';
|
||||
$model->active_backend = 1;
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$id = $model->id;
|
||||
}
|
||||
|
|
@ -62,15 +62,15 @@ class TravelCountryController extends Controller
|
|||
{
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['update-action'])){
|
||||
if($data['update-action'] === 'save-travel-county-service'){
|
||||
$data['active'] = true;//isset($data['active']) ? true : false;
|
||||
if (isset($data['update-action'])) {
|
||||
if ($data['update-action'] === 'save-travel-county-service') {
|
||||
$data['active'] = true; //isset($data['active']) ? true : false;
|
||||
$travel_country = TravelCountry::findOrFail($id);
|
||||
$data['travel_country_id'] = $travel_country->id;
|
||||
$data['crm_travel_country_id'] = $travel_country->crm_id;
|
||||
if($data['travel_county_service_id'] === 'new'){
|
||||
if ($data['travel_county_service_id'] === 'new') {
|
||||
$model = TravelCountryService::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCountryService::find($data['travel_county_service_id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -81,7 +81,7 @@ class TravelCountryController extends Controller
|
|||
}
|
||||
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
if(!isset($data['contact_lands'])){
|
||||
if (!isset($data['contact_lands'])) {
|
||||
$data['contact_lands'] = null;
|
||||
}
|
||||
$data['action'] = isset($data['action']) ? $data['action'] : false;
|
||||
|
|
@ -90,9 +90,9 @@ class TravelCountryController extends Controller
|
|||
$data['active_frontend'] = isset($data['active_frontend']) ? true : false;
|
||||
$data['active_backend'] = isset($data['active_backend']) ? true : false;
|
||||
*/
|
||||
if($id === "new"){
|
||||
if ($id === "new") {
|
||||
$model = TravelCountry::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCountry::find($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -106,11 +106,11 @@ class TravelCountryController extends Controller
|
|||
}
|
||||
//TODO for this time
|
||||
$tc = \App\Models\Sym\TravelCountry::find($model->crm_id);
|
||||
if(!$tc){
|
||||
if (!$tc) {
|
||||
$tc = \App\Models\Sym\TravelCountry::create($data);
|
||||
$model->crm_id = $tc->id;
|
||||
$model->save();
|
||||
}else {
|
||||
} else {
|
||||
$tc->fill($data);
|
||||
$tc->save();
|
||||
}
|
||||
|
|
@ -119,17 +119,18 @@ class TravelCountryController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function delete($id, $del="travel_country"){
|
||||
public function delete($id, $del = "travel_country")
|
||||
{
|
||||
|
||||
if($del === 'travel_country'){
|
||||
if ($del === 'travel_country') {
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
if($model->travel_nationality_requirements){
|
||||
foreach($model->travel_nationality_requirements as $travel_nationality_requirement){
|
||||
if ($model->travel_nationality_requirements) {
|
||||
foreach ($model->travel_nationality_requirements as $travel_nationality_requirement) {
|
||||
$travel_nationality_requirement->delete();
|
||||
}
|
||||
}
|
||||
$tc = \App\Models\Sym\TravelCountry::find($model->crm_id);
|
||||
if($tc){
|
||||
if ($tc) {
|
||||
$tc->delete();
|
||||
}
|
||||
$model->delete();
|
||||
|
|
@ -137,7 +138,7 @@ class TravelCountryController extends Controller
|
|||
return redirect()->back();
|
||||
}
|
||||
|
||||
if($del === 'general_file'){
|
||||
if ($del === 'general_file') {
|
||||
$general_file = GeneralFile::findOrFail($id);
|
||||
$travel_country = $general_file->travel_country;
|
||||
$fileRepo = new GeneralFileRepository($general_file);
|
||||
|
|
@ -146,23 +147,18 @@ class TravelCountryController extends Controller
|
|||
$general_file->delete();
|
||||
\Session()->flash('alert-success', 'Datei gelöscht');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$travel_country->id, 'data']));
|
||||
|
||||
}
|
||||
if($del === 'country_service'){
|
||||
if ($del === 'country_service') {
|
||||
$travel_country_service = TravelCountryService::findOrFail($id);
|
||||
$travel_country = $travel_country_service->travel_country;
|
||||
//check as entry
|
||||
if($travel_country_service->booking_country_services->count() > 0){
|
||||
if ($travel_country_service->booking_country_services->count() > 0) {
|
||||
\Session()->flash('alert-error', 'Die Leistung kann nicht gelöscht werden, diese hat Einträge bei den Buchungen');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$travel_country->id, 'services']));
|
||||
}
|
||||
$travel_country_service->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$travel_country->id, 'services']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue