diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 65fd67d..514058b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,14 @@ - - - + + + + + + + + @@ -28,24 +33,41 @@ - - - - - - - - - + + + + + + + + + + + - + + + + + - + + + + - - - + + + + + + + + + + + @@ -93,14 +115,25 @@ - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - @@ -342,6 +368,13 @@ + + + + + + + @@ -796,19 +842,15 @@ - - - - - + - + @@ -838,15 +880,16 @@ - + - - + + - + + diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 1592766..743cd67 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -5,7 +5,7 @@ namespace PHPSTORM_META { /** * PhpStorm Meta file, to provide autocomplete information for PhpStorm - * Generated on 2020-05-28 13:03:00. + * Generated on 2020-07-03 15:08:29. * * @author Barry vd. Heuvel * @see https://github.com/barryvdh/laravel-ide-helper diff --git a/_ide_helper.php b/_ide_helper.php index 79f305e..9f87d14 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -3,7 +3,7 @@ /** * A helper file for Laravel, to provide autocomplete information to your IDE - * Generated for Laravel 6.18.13 on 2020-05-28 13:02:56. + * Generated for Laravel 6.18.13 on 2020-07-03 15:08:27. * * This file should not be included in your code, only analyzed by your IDE! * diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 62fe2c3..bf4155a 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -367,6 +367,11 @@ namespace App\Models{ * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerFewoFile[] $customer_files * @property-read int|null $customer_files_count * @property-read \App\Models\CustomerFewoMail|null $customer_mail + * @property \Illuminate\Support\Carbon|null $deleted_at + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value) + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed() + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed() */ class CustomerFewoMail extends \Eloquent {} } @@ -542,6 +547,10 @@ namespace App\Models{ * @property-read int|null $booking_files_count * @property float|null $price_balance * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceBalance($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingCountryService[] $booking_country_services + * @property-read int|null $booking_country_services_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingCountryService[] $booking_country_services_checked + * @property-read int|null $booking_country_services_checked_count */ class Booking extends \Eloquent {} } @@ -734,6 +743,8 @@ namespace App\Models{ * @property-read int|null $fewo_reservations_count * @property-read int|null $pages_count * @property-read int|null $travel_user_booking_fewos_count + * @property string|null $pdf_name + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FewoLodging wherePdfName($value) */ class FewoLodging extends \Eloquent {} } @@ -1753,6 +1764,11 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereTravelUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereUpdatedAt($value) * @mixin \Eloquent + * @property \Illuminate\Support\Carbon|null $deleted_at + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereDeletedAt($value) + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile withTrashed() + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile withoutTrashed() */ class CustomerFewoFile extends \Eloquent {} } @@ -1826,6 +1842,33 @@ namespace App\Models{ class TravelCountry extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingProviderService + * + * @property int $id + * @property int $service_provider_service_id + * @property int $booking_id + * @property int $status + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @property ServiceProviderService $service_provider_service + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereServiceProviderServiceId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereStatus($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingProviderService whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingProviderService extends \Eloquent {} +} + namespace App\Models{ /** * Class Salutation @@ -2399,6 +2442,8 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereActive($value) * @property array|null $contact_emails * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereContactEmails($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCompanyService[] $travel_company_services + * @property-read int|null $travel_company_services_count */ class TravelCompany extends \Eloquent {} } @@ -2422,6 +2467,38 @@ namespace App\Models{ class CreditCardType extends \Eloquent {} } +namespace App\Models{ +/** + * Class TravelCompanyService + * + * @property int $id + * @property int $travel_company_id + * @property string $name + * @property string $description + * @property bool $active + * @property int $pos + * @property Carbon $created_at + * @property Carbon $updated_at + * @property TravelCompany $travel_company + * @property Collection|BookingCompanyService[] $booking_company_services + * @package App\Models + * @property-read int|null $booking_company_services_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereDescription($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService wherePos($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereTravelCompanyId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompanyService whereUpdatedAt($value) + * @mixin \Eloquent + */ + class TravelCompanyService extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\CMSContent @@ -2654,6 +2731,33 @@ namespace App\Models{ class Page extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingCompanyService + * + * @property int $id + * @property int $travel_company_service_id + * @property int $booking_id + * @property int $status + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @property TravelCompanyService $travel_company_service + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereStatus($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereTravelCompanyServiceId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCompanyService whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingCompanyService extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\TravelProgramCountry @@ -2783,6 +2887,8 @@ namespace App\Models{ * @property bool|null $active * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereActive($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereContactEmails($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ServiceProviderService[] $service_provider_services + * @property-read int|null $service_provider_services_count */ class ServiceProvider extends \Eloquent {} } @@ -2816,6 +2922,38 @@ namespace App\Models{ class TravelClass extends \Eloquent {} } +namespace App\Models{ +/** + * Class ServiceProviderService + * + * @property int $id + * @property int $service_provider_id + * @property string $name + * @property string $description + * @property bool $active + * @property int $pos + * @property Carbon $created_at + * @property Carbon $updated_at + * @property ServiceProvider $service_provider + * @property Collection|BookingProviderService[] $booking_provider_services + * @package App\Models + * @property-read int|null $booking_provider_services_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereDescription($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService wherePos($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereServiceProviderId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProviderService whereUpdatedAt($value) + * @mixin \Eloquent + */ + class ServiceProviderService extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\DraftType @@ -3455,6 +3593,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountryService wherePos($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountryService whereTravelCountryId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountryService whereUpdatedAt($value) + * @mixin \Eloquent */ class TravelCountryService extends \Eloquent {} } @@ -3557,6 +3696,9 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereTravelCountryServiceId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereUpdatedAt($value) + * @mixin \Eloquent + * @property int|null $status + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereStatus($value) */ class BookingCountryService extends \Eloquent {} } diff --git a/app/Http/Controllers/CMS/CMSFeWoController.php b/app/Http/Controllers/CMS/CMSFeWoController.php index 37ee24d..e365db6 100755 --- a/app/Http/Controllers/CMS/CMSFeWoController.php +++ b/app/Http/Controllers/CMS/CMSFeWoController.php @@ -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; diff --git a/app/Http/Controllers/CustomerFileController.php b/app/Http/Controllers/CustomerFileController.php index 4b63e68..28bf955 100755 --- a/app/Http/Controllers/CustomerFileController.php +++ b/app/Http/Controllers/CustomerFileController.php @@ -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'); diff --git a/app/Http/Controllers/ModalController.php b/app/Http/Controllers/ModalController.php index 2df1468..7574609 100644 --- a/app/Http/Controllers/ModalController.php +++ b/app/Http/Controllers/ModalController.php @@ -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]); diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index c7af0cf..34d8474 100755 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -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."
"; + $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) ? ' '.$travel_country_service->name.'' : ' '.$travel_country_service->name.''; - $ret .= '
'; + $tmp .= '
'; + } + 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."
"; + $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) ? + ' '.$service_provider_service->name.'' : + ' '.$service_provider_service->name.''; + $tmp .= '
'; + } + 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."
"; + $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) ? + ' '.$travel_company_service->name.'' : + ' '.$travel_company_service->name.''; + $tmp .= '
'; + } + if($tmp !== ""){ + $ret .= $hl.$tmp; + } } } } @@ -317,9 +358,9 @@ class RequestController extends Controller ->addColumn('travel_documents', function (Booking $booking) { return $booking->travel_documents ? '' : ''; }) - ->addColumn('booking_country_services', function (Booking $booking) { - return $booking->hasBookingCountryServicesUnchecked() ? '' : - ''; + ->addColumn('booking_services', function (Booking $booking) { + return $booking->hasBookingServicesUnchecked() ? '' : + ''; }) ->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); } } diff --git a/app/Http/Controllers/Settings/ServiceProviderController.php b/app/Http/Controllers/Settings/ServiceProviderController.php index 350060f..986f762 100755 --- a/app/Http/Controllers/Settings/ServiceProviderController.php +++ b/app/Http/Controllers/Settings/ServiceProviderController.php @@ -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'])); + } } diff --git a/app/Http/Controllers/Settings/TravelCompanyController.php b/app/Http/Controllers/Settings/TravelCompanyController.php index 856514a..11782fd 100755 --- a/app/Http/Controllers/Settings/TravelCompanyController.php +++ b/app/Http/Controllers/Settings/TravelCompanyController.php @@ -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'])); + } } } diff --git a/app/Http/Controllers/SyS/Tools/ContentLinkController.php b/app/Http/Controllers/SyS/Tools/ContentLinkController.php index 37c8a1c..f5efae6 100755 --- a/app/Http/Controllers/SyS/Tools/ContentLinkController.php +++ b/app/Http/Controllers/SyS/Tools/ContentLinkController.php @@ -140,9 +140,6 @@ class ContentLinkController extends Controller return redirect()->back(); } - - - public function h1ToTitleTravelGuide() { $TravelGuides = TravelGuide::all(); diff --git a/app/Http/Controllers/TravelUserBookingFewoController.php b/app/Http/Controllers/TravelUserBookingFewoController.php index ca5487d..cc308ee 100755 --- a/app/Http/Controllers/TravelUserBookingFewoController.php +++ b/app/Http/Controllers/TravelUserBookingFewoController.php @@ -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; diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 5c9da88..214ef11 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -163,6 +163,10 @@ use Illuminate\Database\Eloquent\Model; * @property-read int|null $booking_files_count * @property float|null $price_balance * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceBalance($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingCountryService[] $booking_country_services + * @property-read int|null $booking_country_services_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingCountryService[] $booking_country_services_checked + * @property-read int|null $booking_country_services_checked_count */ class Booking extends Model { @@ -484,12 +488,45 @@ class Booking extends Model return $this->hasMany(BookingCountryService::class, 'booking_id')->where('status', '=', 0); } - public function hasBookingCountryServicesUnchecked(){ + public function booking_company_services() + { + return $this->hasMany(BookingCompanyService::class, 'booking_id'); + } + public function booking_company_services_checked() + { + return $this->hasMany(BookingCompanyService::class, 'booking_id')->where('status', '=', 0); + } + + public function booking_provider_services() + { + return $this->hasMany(BookingProviderService::class, 'booking_id'); + } + public function booking_provider_services_checked() + { + return $this->hasMany(BookingProviderService::class, 'booking_id')->where('status', '=', 0); + } + + public function hasBookingServicesUnchecked(){ + $country_services = true; + $provider_services = true; + $company_services = true; if(!$this->booking_country_services->count() || $this->booking_country_services_checked->count() || ($this->booking_country_services->count() !== TravelCountryService::where('crm_travel_country_id', '=', $this->travel_country_id)->count())){ - return false; + $country_services = false; } - return true; + + if(!$this->booking_provider_services->count() || $this->booking_provider_services_checked->count()){ + $provider_services = false; + } + + if(!$this->booking_company_services->count() || $this->booking_company_services_checked->count()){ + $company_services = false; + } + + if($country_services && $provider_services && $provider_services){ + return true; + } + return false; } public function calculate_price_total() @@ -662,7 +699,7 @@ class Booking extends Model { $total = 0; foreach ($this->service_provider_entries as $entry){ - $total += $entry->amount / $entry->factor; + $total += $entry->getAmountRaw() / $entry->factor; } return $raw ? $total : Util::_number_format($total); } @@ -671,7 +708,7 @@ class Booking extends Model { $total = 0; foreach ($this->service_provider_entries as $entry){ - $total += $entry->amount; + $total += $entry->getAmountRaw(); } return $raw ? $total : Util::_number_format($total); } diff --git a/app/Models/BookingCompanyService.php b/app/Models/BookingCompanyService.php new file mode 100644 index 0000000..467620c --- /dev/null +++ b/app/Models/BookingCompanyService.php @@ -0,0 +1,77 @@ + 'int', + 'booking_id' => 'int', + 'status' => 'int' + ]; + + protected $fillable = [ + 'travel_company_service_id', + 'booking_id', + 'status' + ]; + + protected $status_type = [ + 0 => 'offen', + 1 => 'erledigt', + ]; + + public function booking() + { + return $this->belongsTo(Booking::class); + } + + public function travel_company_service() + { + return $this->belongsTo(TravelCompanyService::class); + } + + public static function getStatus($travel_company_service_id, $booking_id){ + $service = BookingCompanyService::where('travel_company_service_id', '=', $travel_company_service_id) + ->where('booking_id', '=', $booking_id)->first(); + + if($service){ + return $service->status; + } + return 0; + } +} diff --git a/app/Models/BookingCountryService.php b/app/Models/BookingCountryService.php index 7c28dd9..da1b92c 100644 --- a/app/Models/BookingCountryService.php +++ b/app/Models/BookingCountryService.php @@ -29,6 +29,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereTravelCountryServiceId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereUpdatedAt($value) * @mixin \Eloquent + * @property int|null $status + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereStatus($value) */ class BookingCountryService extends Model { @@ -64,11 +66,11 @@ class BookingCountryService extends Model } public static function getStatus($travel_country_service_id, $booking_id){ - $booking_country_service = BookingCountryService::where('travel_country_service_id', '=', $travel_country_service_id) + $service = BookingCountryService::where('travel_country_service_id', '=', $travel_country_service_id) ->where('booking_id', '=', $booking_id)->first(); - if($booking_country_service){ - return $booking_country_service->status; + if($service){ + return $service->status; } return 0; } diff --git a/app/Models/BookingProviderService.php b/app/Models/BookingProviderService.php new file mode 100644 index 0000000..d9923b0 --- /dev/null +++ b/app/Models/BookingProviderService.php @@ -0,0 +1,77 @@ + 'int', + 'booking_id' => 'int', + 'status' => 'int' + ]; + + protected $fillable = [ + 'service_provider_service_id', + 'booking_id', + 'status' + ]; + + protected $status_type = [ + 0 => 'offen', + 1 => 'erledigt', + ]; + + public function booking() + { + return $this->belongsTo(Booking::class); + } + + public function service_provider_service() + { + return $this->belongsTo(ServiceProviderService::class); + } + + public static function getStatus($service_provider_service_id, $booking_id){ + $service = BookingProviderService::where('service_provider_service_id', '=', $service_provider_service_id) + ->where('booking_id', '=', $booking_id)->first(); + + if($service){ + return $service->status; + } + return 0; + } +} diff --git a/app/Models/CustomerFewoFile.php b/app/Models/CustomerFewoFile.php index e75f6a8..b4b6790 100644 --- a/app/Models/CustomerFewoFile.php +++ b/app/Models/CustomerFewoFile.php @@ -43,9 +43,16 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereTravelUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereUpdatedAt($value) * @mixin \Eloquent + * @property \Illuminate\Support\Carbon|null $deleted_at + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereDeletedAt($value) + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile withTrashed() + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoFile withoutTrashed() */ class CustomerFewoFile extends Model { + use \Illuminate\Database\Eloquent\SoftDeletes; + protected $connection = 'mysql_stern'; protected $table = 'customer_fewo_files'; @@ -56,6 +63,8 @@ class CustomerFewoFile extends Model 'size' => 'int' ]; + protected $dates = ['deleted_at']; + protected $fillable = [ 'travel_user_id', 'customer_fewo_mail_id', diff --git a/app/Models/CustomerFewoMail.php b/app/Models/CustomerFewoMail.php index 837c18b..489856a 100644 --- a/app/Models/CustomerFewoMail.php +++ b/app/Models/CustomerFewoMail.php @@ -76,9 +76,16 @@ use Illuminate\Database\Eloquent\Model; * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerFewoFile[] $customer_files * @property-read int|null $customer_files_count * @property-read \App\Models\CustomerFewoMail|null $customer_mail + * @property \Illuminate\Support\Carbon|null $deleted_at + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value) + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed() + * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed() */ class CustomerFewoMail extends Model { + use \Illuminate\Database\Eloquent\SoftDeletes; + protected $connection = 'mysql_stern'; protected $table = 'customer_fewo_mails'; @@ -102,7 +109,8 @@ class CustomerFewoMail extends Model protected $dates = [ 'sent_at', 'scheduled_at', - 'delivered_at' + 'delivered_at', + 'deleted_at' ]; protected $fillable = [ @@ -128,6 +136,16 @@ class CustomerFewoMail extends Model 'delivered_at' ]; + protected static function boot() { + parent::boot(); + static::deleting(function($model) { + foreach ($model->customer_fewo_files as $relation) + { + $relation->delete(); + } + }); + } + public function customer_fewo_mail() { return $this->belongsTo(CustomerFewoMail::class, 'reply_id'); diff --git a/app/Models/FewoLodging.php b/app/Models/FewoLodging.php index f2f8909..a8801b1 100644 --- a/app/Models/FewoLodging.php +++ b/app/Models/FewoLodging.php @@ -63,6 +63,8 @@ use Reliese\Database\Eloquent\Model as Eloquent; * @property-read int|null $fewo_reservations_count * @property-read int|null $pages_count * @property-read int|null $travel_user_booking_fewos_count + * @property string|null $pdf_name + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\FewoLodging wherePdfName($value) */ class FewoLodging extends Model { diff --git a/app/Models/FewoReservation.php b/app/Models/FewoReservation.php index 5911cd7..f9e3917 100644 --- a/app/Models/FewoReservation.php +++ b/app/Models/FewoReservation.php @@ -61,4 +61,5 @@ class FewoReservation extends Model { return $this->belongsTo(\App\Models\FewoLodging::class, 'lodging_id'); } + } diff --git a/app/Models/ServiceProvider.php b/app/Models/ServiceProvider.php index b9c9da2..1a038a4 100644 --- a/app/Models/ServiceProvider.php +++ b/app/Models/ServiceProvider.php @@ -31,6 +31,8 @@ use Illuminate\Database\Eloquent\Model; * @property bool|null $active * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereActive($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ServiceProvider whereContactEmails($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ServiceProviderService[] $service_provider_services + * @property-read int|null $service_provider_services_count */ class ServiceProvider extends Model { @@ -60,4 +62,9 @@ class ServiceProvider extends Model { return $this->hasMany(ServiceProviderEntry::class); } + + public function service_provider_services() + { + return $this->hasMany(ServiceProviderService::class, 'service_provider_id', 'id')->orderBy('pos', 'DESC'); + } } diff --git a/app/Models/ServiceProviderEntry.php b/app/Models/ServiceProviderEntry.php index 3803cfb..56550a0 100644 --- a/app/Models/ServiceProviderEntry.php +++ b/app/Models/ServiceProviderEntry.php @@ -6,6 +6,7 @@ namespace App\Models; +use App\Services\Util; use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; @@ -96,19 +97,38 @@ class ServiceProviderEntry extends Model } } + public function getAmountAttribute() + { + return Util::_number_format($this->attributes['amount']); + } + public function getAmountRaw() + { + return $this->attributes['amount']; + } + + public function getAmountEurAttribute() + { + return Util::_number_format($this->attributes['amount_eur']); + } + public function getAmountEurRaw() + { + return $this->attributes['amount_eur']; + } + + public function getAmountFinalEur(){ - $ret = $this->amount; - if($this->amount_eur && $this->amount_eur > 0){ - $ret = $this->amount_eur; + $ret = $this->attributes['amount']; + if($this->attributes['amount_eur'] && $this->attributes['amount_eur'] > 0){ + $ret = $this->attributes['amount_eur']; } return number_format($ret, 2, ',', '.'); } public function getAmountFinalEurRaw(){ - if($this->amount_eur && $this->amount_eur > 0){ - return $this->amount_eur; + if($this->attributes['amount_eur'] && $this->attributes['amount_eur'] > 0){ + return $this->attributes['amount_eur']; } - return $this->amount; + return $this->attributes['amount']; } public function getPaymentDateFormat(){ diff --git a/app/Models/ServiceProviderService.php b/app/Models/ServiceProviderService.php new file mode 100644 index 0000000..032dedf --- /dev/null +++ b/app/Models/ServiceProviderService.php @@ -0,0 +1,76 @@ + 'int', + 'active' => 'bool', + 'pos' => 'int' + ]; + + protected $fillable = [ + 'service_provider_id', + 'name', + 'description', + 'active', + 'pos' + ]; + + protected $status_type = [ + 0 => 'offen', + 1 => 'erledigt', + ]; + + public function service_provider() + { + return $this->belongsTo(ServiceProvider::class); + } + + public function booking_provider_services() + { + return $this->hasMany(BookingProviderService::class); + } + +} diff --git a/app/Models/TravelCompany.php b/app/Models/TravelCompany.php index b011d1a..87c0f94 100644 --- a/app/Models/TravelCompany.php +++ b/app/Models/TravelCompany.php @@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereActive($value) * @property array|null $contact_emails * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCompany whereContactEmails($value) + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCompanyService[] $travel_company_services + * @property-read int|null $travel_company_services_count */ class TravelCompany extends Model { @@ -70,6 +72,10 @@ class TravelCompany extends Model { return $this->hasMany(BookingServiceItem::class); } + public function travel_company_services() + { + return $this->hasMany(TravelCompanyService::class, 'travel_company_id', 'id')->orderBy('pos', 'DESC'); + } public function setPercentageAttribute($value) { diff --git a/app/Models/TravelCompanyService.php b/app/Models/TravelCompanyService.php new file mode 100644 index 0000000..ee011ac --- /dev/null +++ b/app/Models/TravelCompanyService.php @@ -0,0 +1,75 @@ + 'int', + 'active' => 'bool', + 'pos' => 'int' + ]; + + protected $fillable = [ + 'travel_company_id', + 'name', + 'description', + 'active', + 'pos' + ]; + + protected $status_type = [ + 0 => 'offen', + 1 => 'erledigt', + ]; + + public function travel_company() + { + return $this->belongsTo(TravelCompany::class); + } + + public function booking_company_services() + { + return $this->hasMany(BookingCompanyService::class); + } +} diff --git a/app/Models/TravelUserBookingFewo.php b/app/Models/TravelUserBookingFewo.php index 457d05a..80225b5 100644 --- a/app/Models/TravelUserBookingFewo.php +++ b/app/Models/TravelUserBookingFewo.php @@ -159,7 +159,8 @@ class TravelUserBookingFewo extends Model protected $dates = [ 'booking_date', 'from_date', - 'to_date' + 'to_date', + 'deleted_at' ]; protected $fillable = [ @@ -190,6 +191,16 @@ class TravelUserBookingFewo extends Model 'status_text' ]; + protected static function boot() { + parent::boot(); + static::deleting(function($model) { + foreach ($model->customer_fewo_mails as $relation) + { + $relation->delete(); + } + }); + } + public static $customer_mail_dirs = [ 11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'], 12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'], diff --git a/app/Repositories/BookingRepository.php b/app/Repositories/BookingRepository.php index 741a15a..d2bc48c 100644 --- a/app/Repositories/BookingRepository.php +++ b/app/Repositories/BookingRepository.php @@ -4,7 +4,9 @@ namespace App\Repositories; use App\Models\Booking; +use App\Models\BookingCompanyService; use App\Models\BookingCountryService; +use App\Models\BookingProviderService; class BookingRepository extends BaseRepository { @@ -45,17 +47,24 @@ class BookingRepository extends BaseRepository { $this->updateCountryService($data['country_service']); } + if(isset($data['provider_service'])){ + $this->updateProviderService($data['provider_service']); + } + + if(isset($data['company_service'])){ + $this->updateCompanyService($data['company_service']); + } + return $this->model; } public function updateCountryService($country_services){ - foreach ($country_services as $country_service_id=>$val){ $booking_country_service = BookingCountryService::where('travel_country_service_id', '=', $country_service_id) - ->where('booking_id', '=', $this->model->id)->first(); + ->where('booking_id', '=', $this->model->id)->first(); if(!$booking_country_service){ - $booking_country_service = BookingCountryService::create([ + BookingCountryService::create([ 'travel_country_service_id' => $country_service_id, 'booking_id' => $this->model->id, 'status' => $val @@ -67,7 +76,46 @@ class BookingRepository extends BaseRepository { $booking_country_service->save(); } } + } + public function updateProviderService($provider_service){ + foreach ($provider_service as $provider_service_id=>$val){ + $booking_provider_service = BookingProviderService::where('service_provider_service_id', '=', $provider_service_id) + ->where('booking_id', '=', $this->model->id)->first(); + + if(!$booking_provider_service){ + BookingProviderService::create([ + 'service_provider_service_id' => $provider_service_id, + 'booking_id' => $this->model->id, + 'status' => $val + ]); + }else{ + $booking_provider_service->fill([ + 'status' => $val + ]); + $booking_provider_service->save(); + } + } + } + + public function updateCompanyService($company_service){ + foreach ($company_service as $company_service_id=>$val){ + $booking_company_service = BookingCompanyService::where('travel_company_service_id', '=', $company_service_id) + ->where('booking_id', '=', $this->model->id)->first(); + + if(!$booking_company_service){ + BookingCompanyService::create([ + 'travel_company_service_id' => $company_service_id, + 'booking_id' => $this->model->id, + 'status' => $val + ]); + }else{ + $booking_company_service->fill([ + 'status' => $val + ]); + $booking_company_service->save(); + } + } } } \ No newline at end of file diff --git a/database/migrations/2019_03_20_132600_create_fewo_reservation_table.php b/database/migrations/2019_03_20_132600_create_fewo_reservation_table.php index 1772dbb..f18d939 100644 --- a/database/migrations/2019_03_20_132600_create_fewo_reservation_table.php +++ b/database/migrations/2019_03_20_132600_create_fewo_reservation_table.php @@ -20,6 +20,7 @@ class CreateFewoReservationTable extends Migration Schema::connection('mysql_stern')->create('fewo_reservation', function (Blueprint $table) { $table->increments('id'); $table->integer('lodging_id')->nullable(); + $table->date('from_date'); $table->date('to_date'); $table->integer('status'); diff --git a/database/migrations/2020_05_15_111351_create_customer_fewo_mails_table.php b/database/migrations/2020_05_15_111351_create_customer_fewo_mails_table.php index cda393e..b01b113 100644 --- a/database/migrations/2020_05_15_111351_create_customer_fewo_mails_table.php +++ b/database/migrations/2020_05_15_111351_create_customer_fewo_mails_table.php @@ -47,9 +47,13 @@ class CreateCustomerFewoMailsTable extends Migration $table->timestamps(); + $table->softDeletes(); + + $table->foreign('travel_user_booking_fewo_id') ->references('id') - ->on('travel_user_booking_fewos'); + ->on('travel_user_booking_fewos') + ->onDelete('CASCADE'); $table->foreign('travel_user_id') ->references('id') diff --git a/database/migrations/2020_05_15_111435_create_customer_fewo_files_table.php b/database/migrations/2020_05_15_111435_create_customer_fewo_files_table.php index 2adea05..25cf966 100644 --- a/database/migrations/2020_05_15_111435_create_customer_fewo_files_table.php +++ b/database/migrations/2020_05_15_111435_create_customer_fewo_files_table.php @@ -28,13 +28,16 @@ class CreateCustomerFewoFilesTable extends Migration $table->unsignedInteger('size'); $table->timestamps(); + $table->softDeletes(); + $table->foreign('travel_user_id') ->references('id') ->on('travel_users'); $table->foreign('customer_fewo_mail_id') ->references('id') - ->on('customer_fewo_mails'); + ->on('customer_fewo_mails') + ->onDelete('CASCADE'); }); } diff --git a/database/migrations/2020_05_28_112257_create_travel_country_services_table.php b/database/migrations/2020_05_28_112257_create_travel_country_services_table.php index b4bc60e..33527e5 100644 --- a/database/migrations/2020_05_28_112257_create_travel_country_services_table.php +++ b/database/migrations/2020_05_28_112257_create_travel_country_services_table.php @@ -22,10 +22,13 @@ class CreateTravelCountryServicesTable extends Migration $table->string('name')->nullable()->index(); $table->text('description')->nullable(); $table->boolean('active')->default(true); - $table->unsignedTinyInteger('pos')->default(0); + $table->unsignedTinyInteger('pos')->nullable()->default(0); $table->timestamps(); + $table->foreign('crm_travel_country_id') + ->references('id') + ->on('travel_country'); }); } diff --git a/database/migrations/2020_05_28_112359_create_booking_country_services_table.php b/database/migrations/2020_05_28_112359_create_booking_country_services_table.php index dec13de..a6db854 100644 --- a/database/migrations/2020_05_28_112359_create_booking_country_services_table.php +++ b/database/migrations/2020_05_28_112359_create_booking_country_services_table.php @@ -19,7 +19,7 @@ class CreateBookingCountryServicesTable extends Migration $table->unsignedInteger('travel_country_service_id')->index(); $table->bigInteger('booking_id')->index(); - $table->unsignedTinyInteger('status')->default(0); + $table->unsignedTinyInteger('status')->nullable()->default(0); $table->timestamps(); diff --git a/database/migrations/2020_07_03_143033_create_travel_company_services_table.php b/database/migrations/2020_07_03_143033_create_travel_company_services_table.php new file mode 100644 index 0000000..5c4d6e8 --- /dev/null +++ b/database/migrations/2020_07_03_143033_create_travel_company_services_table.php @@ -0,0 +1,43 @@ +increments('id'); + + $table->bigInteger('travel_company_id')->index(); + + $table->string('name')->nullable()->index(); + $table->text('description')->nullable(); + $table->boolean('active')->default(true); + $table->unsignedTinyInteger('pos')->nullable()->default(0); + $table->timestamps(); + + $table->foreign('travel_company_id') + ->references('id') + ->on('travel_company'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('travel_company_services'); + } +} diff --git a/database/migrations/2020_07_03_143108_create_booking_company_services_table.php b/database/migrations/2020_07_03_143108_create_booking_company_services_table.php new file mode 100644 index 0000000..4a3f195 --- /dev/null +++ b/database/migrations/2020_07_03_143108_create_booking_company_services_table.php @@ -0,0 +1,45 @@ +bigIncrements('id'); + + $table->unsignedInteger('travel_company_service_id')->index(); + $table->bigInteger('booking_id')->index(); + + $table->unsignedTinyInteger('status')->nullable()->default(0); + + $table->timestamps(); + + $table->foreign('travel_company_service_id') + ->references('id') + ->on('travel_company_services'); + + $table->foreign('booking_id') + ->references('id') + ->on('booking'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('booking_company_services'); + } +} diff --git a/database/migrations/2020_07_03_143147_create_service_provider_services_table.php b/database/migrations/2020_07_03_143147_create_service_provider_services_table.php new file mode 100644 index 0000000..89c2f53 --- /dev/null +++ b/database/migrations/2020_07_03_143147_create_service_provider_services_table.php @@ -0,0 +1,42 @@ +increments('id'); + + $table->bigInteger('service_provider_id')->index(); + + $table->string('name')->nullable()->index(); + $table->text('description')->nullable(); + $table->boolean('active')->default(true); + $table->unsignedTinyInteger('pos')->nullable()->default(0); + $table->timestamps(); + + $table->foreign('service_provider_id') + ->references('id') + ->on('service_provider'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('service_provider_services'); + } +} diff --git a/database/migrations/2020_07_03_143224_create_booking_provider_services_table.php b/database/migrations/2020_07_03_143224_create_booking_provider_services_table.php new file mode 100644 index 0000000..89661c1 --- /dev/null +++ b/database/migrations/2020_07_03_143224_create_booking_provider_services_table.php @@ -0,0 +1,45 @@ +bigIncrements('id'); + + $table->unsignedInteger('service_provider_service_id')->index(); + $table->bigInteger('booking_id')->index(); + + $table->unsignedTinyInteger('status')->nullable()->default(0); + + $table->timestamps(); + + $table->foreign('service_provider_service_id') + ->references('id') + ->on('service_provider_services'); + + $table->foreign('booking_id') + ->references('id') + ->on('booking'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('booking_provider_services'); + } +} diff --git a/resources/views/admin/modal/company-service.blade.php b/resources/views/admin/modal/company-service.blade.php new file mode 100755 index 0000000..058334f --- /dev/null +++ b/resources/views/admin/modal/company-service.blade.php @@ -0,0 +1,36 @@ + + + diff --git a/resources/views/admin/modal/provider-service.blade.php b/resources/views/admin/modal/provider-service.blade.php new file mode 100755 index 0000000..e9bc2da --- /dev/null +++ b/resources/views/admin/modal/provider-service.blade.php @@ -0,0 +1,36 @@ + + + diff --git a/resources/views/booking/_detail_booking.blade.php b/resources/views/booking/_detail_booking.blade.php index 9c8b42d..0a55ed0 100755 --- a/resources/views/booking/_detail_booking.blade.php +++ b/resources/views/booking/_detail_booking.blade.php @@ -99,29 +99,6 @@ {{ Form::text('notice', $booking->notice, array('placeholder'=>__('Bemerkung'), 'class'=>'form-control', 'id'=>'notice')) }} -
-
Leistungen
-
-
- - @foreach($booking->travel_country->getContactLandsModels() as $TravelCountry) - @if($TravelCountry->stern_travel_country) - @foreach($TravelCountry->stern_travel_country->travel_country_services as $travel_country_service) -
- -
- @endforeach - @endif - @endforeach -

diff --git a/resources/views/booking/_detail_company.blade.php b/resources/views/booking/_detail_company.blade.php new file mode 100755 index 0000000..641b605 --- /dev/null +++ b/resources/views/booking/_detail_company.blade.php @@ -0,0 +1,70 @@ +
+ +
+
+
+ + + + + + + + + + + + + + + + + @if($booking->booking_service_items) + @foreach($booking->booking_service_items as $item) + + + + + + + + + + + @endforeach + @endif + + + +
VeranstalterBezeichnungAbreisedatumReisepreis inkl. MwStRabattErzielte Provision  
+ {{$item->travel_company->name}} + + {{$item->name}}{{\App\Services\Util::_format_date($item->travel_data, 'date')}}{{$item->service_price}}{{$item->commission}}{{$item->service_price_refund}} + + + + {{-- --}} +
+
+ {{-- +
+ +
+ --}} +
+
+
\ No newline at end of file diff --git a/resources/views/booking/_detail_provider.blade.php b/resources/views/booking/_detail_provider.blade.php new file mode 100755 index 0000000..2c9fab6 --- /dev/null +++ b/resources/views/booking/_detail_provider.blade.php @@ -0,0 +1,68 @@ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + @if($booking->service_provider_entries) + @foreach($booking->service_provider_entries as $item) + + + + + + + + + + + @endforeach + @endif + +
LeistungsträgerBetragFaktorBetrag €ZahlungsdatumRe.Nr.bezahlt 
+ {{$item->service_provider->name}} + + {{$item->amount}}{{$item->factor}}{{$item->amount_eur}}{{\App\Services\Util::_format_date($item->payment_date, 'date')}}{{$item->invoice_number}} + + + + {{-- --}}
+
+ {{-- +
+ +
+ --}} +
+
+
\ No newline at end of file diff --git a/resources/views/booking/_detail_services.blade.php b/resources/views/booking/_detail_services.blade.php new file mode 100755 index 0000000..940565c --- /dev/null +++ b/resources/views/booking/_detail_services.blade.php @@ -0,0 +1,90 @@ +
+ +
+ +
+ +
+
Agentur
+
+ @foreach($booking->travel_country->getContactLandsModels() as $TravelCountry) + @if($TravelCountry->stern_travel_country->count()) +
{{$TravelCountry->stern_travel_country->name}}
+ @foreach($TravelCountry->stern_travel_country->travel_country_services as $travel_country_service) +
+ +
+ @endforeach + @endif + @endforeach +
+
+
Leistungsträger
+
+ @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()) +
{{$service_provider_entry->service_provider->name}}
+ @foreach($service_provider_entry->service_provider->service_provider_services as $service_provider_service) +
+ +
+ @endforeach + @endif + @endforeach + @endif +
+ +
+
Reiseveranstalter
+
+ @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()) +
{{$booking_service_item->travel_company->name}}
+ @foreach($booking_service_item->travel_company->travel_company_services as $travel_company_service) +
+ +
+ @endforeach + @endif + @endforeach + @endif +
+
+
+
+   + {{ __('zur Übersicht') }} +
+
+ +
+
+
\ No newline at end of file diff --git a/resources/views/booking/detail.blade.php b/resources/views/booking/detail.blade.php index 8fd0f58..86a77f3 100755 --- a/resources/views/booking/detail.blade.php +++ b/resources/views/booking/detail.blade.php @@ -54,6 +54,11 @@ Buchung + + +
- -