FeWo Mail, Booking Services

This commit is contained in:
Kevin Adametz 2020-07-09 12:36:15 +02:00
parent 730832c8e1
commit e6cc042aee
62 changed files with 1766 additions and 284 deletions

View file

@ -98,7 +98,7 @@ class CMSFeWoController extends Controller
public function detail($id, $step = false)
{
$fewo = FewoLodging::findOrFail($id);
$identifier_fewo = $this->identifier_fewo.Util::sanitize($fewo->single_name); // //this->identifier_fewo = 'fewo-pdf-';
$identifier_fewo = $this->identifier_fewo.Util::sanitize($fewo->pdf_name); // //this->identifier_fewo = 'fewo-pdf-';
$data = [
'contents' => CMSContent::where('identifier', '=', $this->identifier_content)->get()->sortBy('pos'),
@ -114,7 +114,7 @@ class CMSFeWoController extends Controller
{
$data = Request::all();
$fewo = FewoLodging::findOrFail($id);
$identifier_fewo = $this->identifier_fewo.Util::sanitize($fewo->single_name);
$identifier_fewo = $this->identifier_fewo.Util::sanitize($fewo->pdf_name);
$i = 1;
$last_content_id = null;

View file

@ -97,7 +97,7 @@ class CustomerFileController extends Controller
$fewo = FewoLodging::findOrFail($id);
$identifier_content = config('fewo.identifier_content');
$identifier_fewo = config('fewo.identifier_fewo');
$identifier_fewo = $identifier_fewo.Util::sanitize($fewo->single_name);
$identifier_fewo = $identifier_fewo.Util::sanitize($fewo->pdf_name);
$pdf_name = \App\Services\BookingFewo::getFeWoInstructionPDFName($fewo);
$pdf_content = BookingFewo::getFeWoCMSContentForPDF($identifier_content, $identifier_fewo);
$pdf_file = new CreatePDF('pdf.fewo_instructions');

View file

@ -3,6 +3,8 @@
namespace App\Http\Controllers;
use App\Models\GeneralFile;
use App\Models\ServiceProviderService;
use App\Models\TravelCompanyService;
use App\Models\TravelCountry;
use App\Models\TravelCountryService;
use App\Repositories\GeneralFileRepository;
@ -48,6 +50,26 @@ class ModalController extends Controller
$ret = view("admin.modal.country-service", compact('data', 'value'))->render();
}
if($data['action'] === 'modal-travel_company-services'){
if($data['id'] === 'new'){
$value = new TravelCompanyService();
$value->active = true;
}else{
$value = TravelCompanyService::find($data['id']);
}
$ret = view("admin.modal.company-service", compact('data', 'value'))->render();
}
if($data['action'] === 'modal-service_provider-services'){
if($data['id'] === 'new'){
$value = new ServiceProviderService();
$value->active = true;
}else{
$value = ServiceProviderService::find($data['id']);
}
$ret = view("admin.modal.provider-service", compact('data', 'value'))->render();
}
}
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);

View file

@ -233,14 +233,55 @@ class RequestController extends Controller
$booking = Booking::findOrFail($data['booking_id']);
$ret = "";
$count = false;
foreach($booking->travel_country->getContactLandsModels() as $TravelCountry){
if($TravelCountry->stern_travel_country){
$hl = $TravelCountry->stern_travel_country->name."<br>";
$tmp = "";
foreach($TravelCountry->stern_travel_country->travel_country_services as $travel_country_service){
$ret .= \App\Models\BookingCountryService::getStatus($travel_country_service->id, $booking->id) ?
$tmp .= \App\Models\BookingCountryService::getStatus($travel_country_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$travel_country_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$travel_country_service->name.'</span>';
$ret .= '<br>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
}
}
}
if($booking->service_provider_entries->count()){
foreach($booking->service_provider_entries as $service_provider_entry){
if($service_provider_entry->service_provider->service_provider_services->count()){
$hl = $service_provider_entry->service_provider->name."<br>";
$tmp = "";
foreach($service_provider_entry->service_provider->service_provider_services as $service_provider_service){
$tmp .= \App\Models\BookingProviderService::getStatus($service_provider_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$service_provider_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$service_provider_service->name.'</span>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
}
}
}
}
if($booking->booking_service_items->count()){
foreach($booking->booking_service_items as $booking_service_item){
if($booking_service_item->travel_company->travel_company_services->count()){
$hl = $booking_service_item->travel_company->name."<br>";
$tmp = "";
foreach($booking_service_item->travel_company->travel_company_services as $travel_company_service){
$tmp .= \App\Models\BookingCompanyService::getStatus($travel_company_service->id, $booking->id) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$travel_company_service->name.'</span>' :
'<span class="badge badge-pill badge-danger""><i class="fa fa-times"></i> '.$travel_company_service->name.'</span>';
$tmp .= '<br>';
}
if($tmp !== ""){
$ret .= $hl.$tmp;
}
}
}
}
@ -317,9 +358,9 @@ class RequestController extends Controller
->addColumn('travel_documents', function (Booking $booking) {
return $booking->travel_documents ? '<span data-order="1" class="badge badge-pill badge-success" title="Reiseunterlagen" data-placement="top" rel="tooltip"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger" title="Reiseunterlagen" data-placement="top" rel="tooltip"><i class="fa fa-times"></i></span>';
})
->addColumn('booking_country_services', function (Booking $booking) {
return $booking->hasBookingCountryServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="Reise-, Agenturleistungen"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="Reise-, Agenturleistungen"><i class="fa fa-times"></i></span>';
->addColumn('booking_services', function (Booking $booking) {
return $booking->hasBookingServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-times"></i></span>';
})
->addColumn('sf_guard_user_id', function (Booking $booking) {
@ -421,7 +462,7 @@ class RequestController extends Controller
->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', 'travel_company_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_country_services', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt'])
->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'travel_company_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_services', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt'])
->make(true);
}
}

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use App\Models\ServiceProvider;
use App\Models\ServiceProviderService;
use App\Services\Util;
use Request;
@ -24,31 +25,87 @@ class ServiceProviderController extends Controller
}
public function update(){
public function detail($id, $step = false)
{
if($id === "new") {
$model = new ServiceProvider();
$id = 'new';
$model->active = 1;
}else{
$model = ServiceProvider::findOrFail($id);
$id = $model->id;
}
$data = [
'model' => $model,
'id' => $id,
'step' => $step,
];
return view('settings.service_provider.detail', $data);
}
public function update($id){
$data = Request::all();
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
$data['active'] = isset($data['active']) ? true : false;
if($data['id'] === "new"){
if(isset($data['update-action'])){
if($data['update-action'] === 'save-service-provider-service'){
$data['active'] = true;//isset($data['active']) ? true : false;
$service_provider = ServiceProvider::findOrFail($id);
$data['service_provider_id'] = $service_provider->id;
if($data['service_provider_service_id'] === 'new'){
$model = ServiceProviderService::create($data);
}else{
$model = ServiceProviderService::find($data['service_provider_service_id']);
$model->fill($data);
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect($data['back']);
}
}
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
if($id === "new"){
$model = ServiceProvider::create($data);
}else{
$model = ServiceProvider::find($data['id']);
$model = ServiceProvider::find($id);
$model->fill($data);
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('admin_settings_service_provider'));
return redirect(route('admin_settings_service_provider_detail', [$model->id, $data['action']]));
}
public function delete($id){
public function delete($id, $del="service_provider"){
abort(404, 'Noch keine Funktion');
$model = ServiceProvider::findOrFail($id);
$model->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect()->back();
if($del === 'service_provider') {
abort(404, 'Noch keine Funktion');
$model = ServiceProvider::findOrFail($id);
$model->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect()->back();
}
if($del === 'provider_service'){
$service = ServiceProviderService::findOrFail($id);
$service_provider = $service->service_provider;
//check as entry
if($service->booking_provider_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_service_provider_detail', [$service_provider->id, 'services']));
}
$service->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect(route('admin_settings_service_provider_detail', [$service_provider->id, 'services']));
}
}

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use App\Models\TravelCompany;
use App\Models\TravelCompanyService;
use App\Services\Util;
use Request;
@ -24,33 +25,85 @@ class TravelCompanyController extends Controller
}
public function update(){
public function detail($id, $step = false)
{
if($id === "new") {
$model = new TravelCompany();
$id = 'new';
$model->active = 1;
}else{
$model = TravelCompany::findOrFail($id);
$id = $model->id;
}
$data = [
'model' => $model,
'id' => $id,
'step' => $step,
];
return view('settings.travel_company.detail', $data);
}
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;
$travel_company = TravelCompany::findOrFail($id);
$data['travel_company_id'] = $travel_company->id;
if($data['travel_company_service_id'] === 'new'){
$model = TravelCompanyService::create($data);
}else{
$model = TravelCompanyService::find($data['travel_company_service_id']);
$model->fill($data);
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect($data['back']);
}
}
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
$data['active'] = isset($data['active']) ? true : false;
$data['is_allowed_edit_commission'] = isset($data['is_allowed_edit_commission']) ? true : false;
$data['is_inhouse'] = isset($data['is_inhouse']) ? true : false;
if($data['id'] === "new"){
if($id === "new"){
$model = TravelCompany::create($data);
}else{
$model = TravelCompany::find($data['id']);
$model = TravelCompany::find($id);
$model->fill($data);
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('admin_settings_travel_company'));
return redirect(route('admin_settings_travel_company_detail', [$model->id, $data['action']]));
}
public function delete($id){
public function delete($id, $del="travel_company"){
abort(404, 'Noch keine Funktion');
$model = TravelCompany::findOrFail($id);
$model->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect()->back();
if($del === 'travel_country') {
abort(404, 'Noch keine Funktion');
$model = TravelCompany::findOrFail($id);
$model->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect()->back();
}
if($del === 'company_service'){
$service = TravelCompanyService::findOrFail($id);
$travel_company = $service->travel_company;
//check as entry
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']));
}
$service->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
}
}
}

View file

@ -140,9 +140,6 @@ class ContentLinkController extends Controller
return redirect()->back();
}
public function h1ToTitleTravelGuide()
{
$TravelGuides = TravelGuide::all();

View file

@ -61,7 +61,7 @@ class TravelUserBookingFewoController extends Controller
/* if($travel_user_booking_fewo->fewo_lodging){
$this->identifier_fewo = $this->identifier_fewo.Util::sanitize($travel_user_booking_fewo->fewo_lodging->single_name);
$this->identifier_fewo = $this->identifier_fewo.Util::sanitize($travel_user_booking_fewo->fewo_lodging->pdf_name);
}*/
}
if(!$travel_user_booking_fewo->info_mail_text) {
@ -187,13 +187,27 @@ class TravelUserBookingFewoController extends Controller
if($del === 'travel_user_booking_fewo') {
$model = TravelUserBookingFewo::findOrFail($id);
//Reservations
$FewoReservations = FewoReservation::where('lodging_id', $model->fewo_lodging_id)->where('from_date', $model->getFromDateRaw())->where('to_date', $model->getToDateRaw())->get();
foreach ($FewoReservations as $FewoReservation) {
$FewoReservation->delete();
}
//Files
$FewoFiles = TravelUserBookingFile::where('travel_user_booking_fewo_id', $model->id)->get();
foreach ($FewoFiles as $file) {
$fileRepo = new BookingFewoFileRepository($file);
$fileRepo->_set('disk', 'booking_fewo');
$fileRepo->delete();
$file->delete();
}
//Mails
//CASCADE
$model->delete();
\Session()->flash('alert-success', __('Buchung gelöscht sowie die Reservierung im Sterntrous Kalender'));
}
if($del === 'booking_fewo_files'){
$booking_fewo_file = TravelUserBookingFile::findOrFail($id);
$travel_user_booking_fewo = $booking_fewo_file->travel_user_booking_fewo;