File Controller, Booking Organisation, import Draft, old arrangements
35
.env
|
|
@ -15,31 +15,44 @@ APP_DOMAIN_TLD=test
|
|||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
# Standard Database Connection
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=192.168.1.8
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=cmssso_db1
|
||||
DB_USERNAME=kadmin
|
||||
DB_PASSWORD=KT32vQ7ix
|
||||
DB_DATABASE=stern_crm
|
||||
DB_USERNAME=sail
|
||||
DB_PASSWORD=password
|
||||
|
||||
DB_CONNECTION_STERN=mysql
|
||||
DB_HOST_STERN=192.168.1.8
|
||||
# STERN Database Connection
|
||||
DB_HOST_STERN=mysql-stern
|
||||
DB_PORT_STERN=3306
|
||||
DB_DATABASE_STERN=relaunch1
|
||||
DB_USERNAME_STERN=kadmin
|
||||
DB_PASSWORD_STERN=KT32vQ7ix
|
||||
DB_DATABASE_STERN=stern_db
|
||||
DB_USERNAME_STERN=sail
|
||||
DB_PASSWORD_STERN=password
|
||||
|
||||
# Docker Port Forwards
|
||||
FORWARD_DB_PORT=33064
|
||||
FORWARD_DB_PORT_STERN=33065
|
||||
FORWARD_REDIS_PORT=6379
|
||||
MYSQL_EXTRA_OPTIONS=
|
||||
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_HOST=redis
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
# Vite Port for Development
|
||||
VITE_PORT=5173
|
||||
# Sail Configuration
|
||||
WWWGROUP=1000
|
||||
WWWUSER=1000
|
||||
SAIL_XDEBUG_MODE=off
|
||||
|
||||
MAIL_BBC=kevin@adametz.media
|
||||
MAIL_FEWO_EMPLOYEE=kevin@adametz.media
|
||||
|
|
|
|||
15
.gitignore
vendored
|
|
@ -25,11 +25,24 @@ Icon
|
|||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
.idea/
|
||||
.claude/
|
||||
.cursor/
|
||||
.cursorrules/
|
||||
.cursorrules.md/
|
||||
.cursorrules.md.txt/
|
||||
.cursorrules.md.txt.txt/
|
||||
.cursorrules.md.txt.txt.txt/
|
||||
|
||||
/vendor
|
||||
/node_modules
|
||||
/storage/app
|
||||
/storage/language
|
||||
/storage/framework
|
||||
/storage/logs
|
||||
/public/vendor
|
||||
.idea
|
||||
.idea/
|
||||
.vscode/
|
||||
_static/
|
||||
_work/
|
||||
_storage/
|
||||
|
|
|
|||
282
_ide_helper.php
|
|
@ -31,7 +31,6 @@ class BookingController extends Controller
|
|||
$this->middleware(['admin', '2fa']);
|
||||
$this->bookingRepo = $bookingRepo;
|
||||
$this->custRepo = $custRepo;
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
|
|
@ -48,7 +47,6 @@ class BookingController extends Controller
|
|||
if ($id == "new") {
|
||||
$booking = new Booking();
|
||||
$id = 'new';
|
||||
|
||||
} else {
|
||||
$booking = Booking::findOrFail($id);
|
||||
$booking->getPassolutionPDF(true);
|
||||
|
|
@ -60,7 +58,6 @@ class BookingController extends Controller
|
|||
'show_modal_quill_preview' => true,
|
||||
];
|
||||
return view('booking.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
|
|
@ -76,6 +73,28 @@ class BookingController extends Controller
|
|||
}
|
||||
|
||||
|
||||
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');
|
||||
|
|
@ -203,13 +222,14 @@ class BookingController extends Controller
|
|||
$i++;
|
||||
}
|
||||
$redirect = redirect(route('booking_detail', [$booking->id]) . "#collapseBookingOrganisation");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === 'saveCustomer' || $data['action'] === 'saveAll' || $data['action'] === 'save_lead_status' || $data['action'] === 'update_booking' ||
|
||||
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'){
|
||||
$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);
|
||||
|
|
@ -288,7 +308,8 @@ class BookingController extends Controller
|
|||
return $redirect;
|
||||
}
|
||||
|
||||
public function loadModal(){
|
||||
public function loadModal()
|
||||
{
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if (Request::ajax()) {
|
||||
|
|
@ -334,8 +355,6 @@ class BookingController extends Controller
|
|||
$data['storno_level'] = $document_storno->data->storno_level;
|
||||
$data['storno_level_number'] = _number_format($document_storno->data->storno_level);
|
||||
$data['storno_total_price'] = '';
|
||||
|
||||
|
||||
} else {
|
||||
$data['storno_date'] = date('d.m.Y');
|
||||
$data['storno_print'] = date('d.m.Y');
|
||||
|
|
@ -343,7 +362,6 @@ class BookingController extends Controller
|
|||
$data['storno_level'] = 100;
|
||||
$data['storno_level_number'] = '';
|
||||
$data['storno_total_price'] = '';
|
||||
|
||||
}
|
||||
|
||||
$ret = view("booking.modal_create_storno", compact('data'))->render();
|
||||
|
|
@ -363,7 +381,8 @@ class BookingController extends Controller
|
|||
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();
|
||||
|
|
@ -372,7 +391,8 @@ class BookingController extends Controller
|
|||
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)) {
|
||||
abort(404);
|
||||
|
|
@ -428,11 +448,10 @@ class BookingController extends Controller
|
|||
\Session()->flash('alert-success', __('Neuen Teilnehmer hinzugefügt'));
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingParticipant");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function delete($id, $del="booking"){
|
||||
public function delete($id, $del = "booking")
|
||||
{
|
||||
|
||||
if ($del === 'booking_file') {
|
||||
$booking_file = BookingFile::findOrFail($id);
|
||||
|
|
@ -447,7 +466,6 @@ class BookingController extends Controller
|
|||
$booking_notice->delete();
|
||||
\Session()->flash('alert-success', 'Notiz gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingNotice");
|
||||
|
||||
}
|
||||
|
||||
if ($del === 'passolution_file') {
|
||||
|
|
@ -455,7 +473,6 @@ class BookingController extends Controller
|
|||
$booking->resyncPassolutionPDF();
|
||||
\Session()->flash('alert-success', 'Passolution erneuert');
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingFiles");
|
||||
|
||||
}
|
||||
|
||||
if ($del === 'service_provider_entry') {
|
||||
|
|
@ -464,7 +481,6 @@ class BookingController extends Controller
|
|||
$ServiceProviderEntry->delete();
|
||||
\Session()->flash('alert-success', 'Leistungsträger gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id]) . "#collapseBookingProvider");
|
||||
|
||||
}
|
||||
|
||||
if ($del === 'booking_service_item') {
|
||||
|
|
@ -487,26 +503,30 @@ class BookingController extends Controller
|
|||
}
|
||||
|
||||
|
||||
private function deleteBookingFile($booking_file){
|
||||
private function deleteBookingFile($booking_file)
|
||||
{
|
||||
$fileRepo = new BookingFileRepository($booking_file);
|
||||
$fileRepo->_set('disk', 'booking');
|
||||
$fileRepo->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();
|
||||
}
|
||||
|
||||
private function deleteBookingDocument($booking_document){
|
||||
private function deleteBookingDocument($booking_document)
|
||||
{
|
||||
$booking_document->deleteFile();
|
||||
$booking_document->delete();
|
||||
}
|
||||
|
||||
public function deleteComplete($id){
|
||||
public function deleteComplete($id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
|
||||
if ($booking->booking_files) {
|
||||
|
|
@ -578,7 +598,4 @@ class BookingController extends Controller
|
|||
\Session()->flash('alert-success', 'Buchung gelöscht');
|
||||
return redirect(route('requests'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ class FileController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
|
||||
public function show($id = null, $disk = null, $do = 'file')
|
||||
|
|
@ -69,12 +67,19 @@ class FileController extends Controller
|
|||
|
||||
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;
|
||||
|
|
@ -84,7 +89,8 @@ class FileController extends Controller
|
|||
}
|
||||
|
||||
|
||||
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,7 +98,11 @@ 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') {
|
||||
$headers = [
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class TravelCompanyController extends Controller
|
|||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id === "new") {
|
||||
if ($id == "new") {
|
||||
$model = new TravelCompany();
|
||||
$id = 'new';
|
||||
$model->active = 1;
|
||||
|
|
@ -45,7 +45,8 @@ class TravelCompanyController extends Controller
|
|||
return view('settings.travel_company.detail', $data);
|
||||
}
|
||||
|
||||
public function update($id){
|
||||
public function update($id)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
|
@ -79,10 +80,10 @@ 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') {
|
||||
abort(404, 'Noch keine Funktion');
|
||||
|
|
@ -105,7 +106,4 @@ class TravelCompanyController extends Controller
|
|||
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ 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;
|
||||
|
|
@ -119,7 +119,8 @@ class TravelCountryController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function delete($id, $del="travel_country"){
|
||||
public function delete($id, $del = "travel_country")
|
||||
{
|
||||
|
||||
if ($del === 'travel_country') {
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
|
|
@ -146,7 +147,6 @@ 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') {
|
||||
$travel_country_service = TravelCountryService::findOrFail($id);
|
||||
|
|
@ -159,10 +159,6 @@ class TravelCountryController extends Controller
|
|||
$travel_country_service->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$travel_country->id, 'services']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
//use FPDI in myMerge v2
|
||||
|
|
@ -39,12 +40,14 @@ class MyPDFMerger
|
|||
|
||||
public function myMerge($outputmode = 'browser', $outputpath = 'newfile.pdf', $theme = false)
|
||||
{
|
||||
if (!isset($this->_files) || !is_array($this->_files)): throw new \exception("No PDFs to merge."); endif;
|
||||
//$theme = false;
|
||||
if (!isset($this->_files) || !is_array($this->_files)): throw new \exception("No PDFs to merge.");
|
||||
endif;
|
||||
|
||||
$fpdi = new \setasign\Fpdi\Fpdi();
|
||||
$first = 1;
|
||||
|
||||
//
|
||||
|
||||
//merger operations
|
||||
foreach ($this->_files as $file) {
|
||||
$filename = $file[0];
|
||||
|
|
@ -60,7 +63,6 @@ class MyPDFMerger
|
|||
$template = $fpdi->importPage($i);
|
||||
$size = $fpdi->getTemplateSize($template);
|
||||
$orientation = ($size['height'] > $size['width']) ? 'P' : 'L';
|
||||
|
||||
$fpdi->AddPage($orientation, array($size['width'], $size['height']));
|
||||
if ($theme) {
|
||||
$fpdi->setSourceFile(__DIR__ . '/../../public/pdf/' . $theme . '-' . $first . '.pdf');
|
||||
|
|
@ -69,14 +71,14 @@ class MyPDFMerger
|
|||
}
|
||||
$backId = $fpdi->importPage(1);
|
||||
$fpdi->useTemplate($backId);
|
||||
|
||||
}
|
||||
$fpdi->useTemplate($template);
|
||||
}
|
||||
} else {
|
||||
foreach ($filepages as $page) {
|
||||
$count = $fpdi->setSourceFile($filename);
|
||||
if (!$template = $fpdi->importPage($page)): throw new \exception("Could not load page '$page' in PDF '$filename'. Check that the page exists."); endif;
|
||||
if (!$template = $fpdi->importPage($page)): throw new \exception("Could not load page '$page' in PDF '$filename'. Check that the page exists.");
|
||||
endif;
|
||||
$size = $fpdi->getTemplateSize($template);
|
||||
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
|
||||
|
||||
|
|
@ -110,8 +112,6 @@ class MyPDFMerger
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,11 +160,13 @@ class MyPDFMerger
|
|||
$y = $ind[1]; //end page
|
||||
|
||||
if ($x > $y): throw new \exception("Starting page, '$x' is greater than ending page '$y'.");
|
||||
return false; endif;
|
||||
return false;
|
||||
endif;
|
||||
|
||||
//add middle pages
|
||||
while ($x <= $y): $newpages[] = (int)$x;
|
||||
$x++; endwhile;
|
||||
$x++;
|
||||
endwhile;
|
||||
} else {
|
||||
$newpages[] = (int)$ind[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ class Booking extends Model
|
|||
|
||||
public function arrangements()
|
||||
{
|
||||
return $this->hasMany(Arrangement::class);
|
||||
return $this->hasMany(Arrangement::class)->orderBy('view_position', 'DESC');
|
||||
}
|
||||
|
||||
public function arrangement_types()
|
||||
|
|
@ -614,9 +614,9 @@ class Booking extends Model
|
|||
return implode('', $this->airline_ids);
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
public function hasBookingServicesUnchecked(){
|
||||
public function hasBookingServicesUnchecked()
|
||||
{
|
||||
$country_services = true;
|
||||
$provider_services = true;
|
||||
$company_services = true;
|
||||
|
|
@ -635,10 +635,11 @@ class Booking extends Model
|
|||
}
|
||||
}
|
||||
|
||||
if($has_country_services && !$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())){
|
||||
if (
|
||||
$has_country_services && !$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())
|
||||
) {
|
||||
$country_services = false;
|
||||
|
||||
}
|
||||
|
||||
foreach ($this->service_provider_entries as $service_provider_entry) {
|
||||
|
|
@ -661,7 +662,6 @@ class Booking extends Model
|
|||
if ($has_company_services && !$this->booking_company_services->count() || $this->booking_company_services_checked->count()) {
|
||||
if ($this->booking_service_items->count()) {
|
||||
$company_services = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -670,12 +670,12 @@ class Booking extends Model
|
|||
}
|
||||
if ($country_services && $provider_services && $company_services) {
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasBookingParticipantsPass(){
|
||||
public function hasBookingParticipantsPass()
|
||||
{
|
||||
if ($this->participant_firstname) {
|
||||
if (!$this->participant_pass) {
|
||||
return false;
|
||||
|
|
@ -692,7 +692,8 @@ class Booking extends Model
|
|||
}
|
||||
|
||||
|
||||
public function getPassolutionPDF($create = false, $resync = false){
|
||||
public function getPassolutionPDF($create = false, $resync = false)
|
||||
{
|
||||
|
||||
$nats = [];
|
||||
|
||||
|
|
@ -731,7 +732,8 @@ class Booking extends Model
|
|||
return $this->passolutionPDFs;
|
||||
}
|
||||
|
||||
public function resyncPassolutionPDF(){
|
||||
public function resyncPassolutionPDF()
|
||||
{
|
||||
return $this->getPassolutionPDF(true, true);
|
||||
}
|
||||
|
||||
|
|
@ -774,7 +776,6 @@ class Booking extends Model
|
|||
$this->price = $total_adult + $total_children;
|
||||
$this->price_total = $this->getPriceRaw() + $this->getServiceTotal(true);
|
||||
$this->save();
|
||||
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
|
|
@ -868,35 +869,48 @@ class Booking extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getStartDateFormat(){
|
||||
if(!$this->attributes['start_date']){ return ""; }
|
||||
public function getStartDateFormat()
|
||||
{
|
||||
if (!$this->attributes['start_date']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($this->attributes['start_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getEndDateFormat(){
|
||||
if(!$this->attributes['end_date']){ return ""; }
|
||||
public function getEndDateFormat()
|
||||
{
|
||||
if (!$this->attributes['end_date']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($this->attributes['end_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getBookingDateFormat(){
|
||||
if(!$this->attributes['booking_date']){ return ""; }
|
||||
public function getBookingDateFormat()
|
||||
{
|
||||
if (!$this->attributes['booking_date']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($this->attributes['booking_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function getFinalPaymentDateFormat(){
|
||||
if(!$this->attributes['final_payment_date']){ return ""; }
|
||||
public function getFinalPaymentDateFormat()
|
||||
{
|
||||
if (!$this->attributes['final_payment_date']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($this->attributes['final_payment_date'])->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function isCanceled(){
|
||||
public function isCanceled()
|
||||
{
|
||||
return ($this->attributes['canceled'] !== null);
|
||||
}
|
||||
|
||||
//erlös #getRevenueFactor
|
||||
public function proceeds($raw = false){
|
||||
public function proceeds($raw = false)
|
||||
{
|
||||
$proceeds = $this->attributes['price'] - $this->attributes['price_balance'] - $this->getServiceProviderPaymentsFactorTotal(true);
|
||||
return $raw ? $proceeds : Util::_number_format($proceeds);
|
||||
|
||||
}
|
||||
|
||||
public function getServiceTotal($raw = false)
|
||||
|
|
@ -927,7 +941,8 @@ class Booking extends Model
|
|||
return $raw ? $total : Util::_number_format($total);
|
||||
}
|
||||
|
||||
public function getKontoNumber(){
|
||||
public function getKontoNumber()
|
||||
{
|
||||
|
||||
switch ($this->ev_number) {
|
||||
case 'E01':
|
||||
|
|
@ -942,42 +957,46 @@ class Booking extends Model
|
|||
case 'E04':
|
||||
return '4014';
|
||||
break;
|
||||
|
||||
}
|
||||
return $this->ev_number;
|
||||
}
|
||||
|
||||
public function getBookingNumber()
|
||||
{
|
||||
if ($this->lead)
|
||||
{
|
||||
if ($this->lead) {
|
||||
return $this->lead->id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getPayingOutType(){
|
||||
public function getPayingOutType()
|
||||
{
|
||||
return isset(self::$paying_out_types[$this->paying_out]) ? self::$paying_out_types[$this->paying_out] : '-';
|
||||
}
|
||||
|
||||
public function getInsuranceOfferType(){
|
||||
public function getInsuranceOfferType()
|
||||
{
|
||||
return isset(self::$insurance_offer_types[$this->insurance_offer]) ? self::$insurance_offer_types[$this->insurance_offer] : '-';
|
||||
}
|
||||
|
||||
public function getPayingOutStatusType(){
|
||||
public function getPayingOutStatusType()
|
||||
{
|
||||
return isset(self::$paying_out_status_types[$this->paying_out_status]) ? self::$paying_out_status_types[$this->paying_out_status] : '-';
|
||||
}
|
||||
|
||||
public function getRefundType(){
|
||||
public function getRefundType()
|
||||
{
|
||||
return isset(self::$refund_types[$this->refund]) ? self::$refund_types[$this->refund] : '-';
|
||||
}
|
||||
|
||||
public function getXxTktType(){
|
||||
public function getXxTktType()
|
||||
{
|
||||
return isset(self::$xx_tkt_types[$this->xx_tkt]) ? self::$xx_tkt_types[$this->xx_tkt] : '-';
|
||||
}
|
||||
|
||||
public function getXxTktTypeList(){
|
||||
public function getXxTktTypeList()
|
||||
{
|
||||
if (isset(self::$xx_tkt_types[$this->xx_tkt])) {
|
||||
if ($this->xx_tkt == 1 && $this->xx_tkt_date) {
|
||||
return Carbon::parse($this->xx_tkt_date)->format('d.m.Y');
|
||||
|
|
@ -987,7 +1006,8 @@ class Booking extends Model
|
|||
return "-";
|
||||
}
|
||||
|
||||
public function getRefundTypeList(){
|
||||
public function getRefundTypeList()
|
||||
{
|
||||
if (isset(self::$refund_types[$this->refund])) {
|
||||
if ($this->refund == 1 && $this->refund_date) {
|
||||
return Carbon::parse($this->refund_date)->format('d.m.Y');
|
||||
|
|
@ -997,23 +1017,28 @@ class Booking extends Model
|
|||
return "-";
|
||||
}
|
||||
|
||||
public function getPayingOutColor(){
|
||||
public function getPayingOutColor()
|
||||
{
|
||||
return isset($this->paying_out_colors[$this->paying_out]) ? $this->paying_out_colors[$this->paying_out] : '';
|
||||
}
|
||||
|
||||
public function getPayingOutStatusColor(){
|
||||
public function getPayingOutStatusColor()
|
||||
{
|
||||
return isset($this->paying_out_status_colors[$this->paying_out_status]) ? $this->paying_out_status_colors[$this->paying_out_status] : '';
|
||||
}
|
||||
|
||||
public function getRefundColor(){
|
||||
public function getRefundColor()
|
||||
{
|
||||
return isset($this->refund_colors[$this->refund]) ? $this->refund_colors[$this->refund] : '-';
|
||||
}
|
||||
|
||||
public function getXxTktColor(){
|
||||
public function getXxTktColor()
|
||||
{
|
||||
return isset($this->xx_tkt_colors[$this->xx_tkt]) ? $this->xx_tkt_colors[$this->xx_tkt] : '-';
|
||||
}
|
||||
|
||||
public function countCustomerMailsBy($dir, $subdir=false){
|
||||
public function countCustomerMailsBy($dir, $subdir = false)
|
||||
{
|
||||
|
||||
if ($dir === 11) {
|
||||
return $this->customer_mails->where('draft', true)->where('dir', '!=', 12)->count();
|
||||
|
|
@ -1026,13 +1051,14 @@ class Booking extends Model
|
|||
|
||||
/*DOCUMENTS*/
|
||||
|
||||
public function hasDocument($identifier){
|
||||
public function hasDocument($identifier)
|
||||
{
|
||||
return $this->booking_documents->where('identifier', $identifier)->count() ? true : false;
|
||||
}
|
||||
|
||||
public function getDocument($identifier){
|
||||
public function getDocument($identifier)
|
||||
{
|
||||
return $this->booking_documents->where('identifier', $identifier)->first();
|
||||
|
||||
}
|
||||
|
||||
public function isDepositPossible($maxIntervalDays = false)
|
||||
|
|
@ -1042,12 +1068,14 @@ class Booking extends Model
|
|||
return $diffInDays > $maxIntervalDays;
|
||||
}
|
||||
|
||||
public function getConfirmationDeposit($percentageRate = false){
|
||||
public function getConfirmationDeposit($percentageRate = false)
|
||||
{
|
||||
$percentageRate = $percentageRate ? $percentageRate : config('booking.deposit_percentage_rate');
|
||||
return ($this->isDepositPossible() ? round($this->getPriceRaw() * $percentageRate / 100) : 0);
|
||||
}
|
||||
|
||||
public function getConfirmationFinalPayment(){
|
||||
public function getConfirmationFinalPayment()
|
||||
{
|
||||
return $this->getPriceRaw() - $this->getConfirmationDeposit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class TravelCompany extends Model
|
|||
|
||||
public function getPercentageAttribute()
|
||||
{
|
||||
return Util::_number_format($this->attributes['percentage']);
|
||||
return isset($this->attributes['percentage']) ? Util::_number_format($this->attributes['percentage']) : 0;
|
||||
}
|
||||
|
||||
public function getPercentageRaw()
|
||||
|
|
|
|||
72
app/Policies/ModelPolicy.php
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
abstract class ModelPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
abstract protected function getModelClass(): string;
|
||||
|
||||
public function viewAny(User $user)
|
||||
{
|
||||
return $user->can('view-any-' . $this->getModelClass());
|
||||
}
|
||||
|
||||
public function view(User $user, Model $model)
|
||||
{
|
||||
if ($user->can('view-' . $this->getModelClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->can('view-self-' . $this->getModelClass())) {
|
||||
return $this->isOwner($user, $model);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function create(User $user)
|
||||
{
|
||||
return $user->can('create-' . $this->getModelClass());
|
||||
}
|
||||
|
||||
public function update(User $user, Model $model)
|
||||
{
|
||||
if ($user->can('update-' . $this->getModelClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->can('update-self-' . $this->getModelClass())) {
|
||||
return $this->isOwner($user, $model);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete(User $user, Model $model)
|
||||
{
|
||||
if ($user->can('delete-' . $this->getModelClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->can('delete-self-' . $this->getModelClass())) {
|
||||
return $this->isOwner($user, $model);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isOwner(User $user, Model $model): bool
|
||||
{
|
||||
if (!empty($user) && method_exists($model, 'user')) {
|
||||
return $user->getKey() === $model->getRelation('user')->getKey();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
|
|
@ -14,6 +15,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
URL::forceScheme('https');
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ use App\Libraries\CreatePDFCoupon;
|
|||
use Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class BookingPDFRepository extends BaseRepository {
|
||||
class BookingPDFRepository extends BaseRepository
|
||||
{
|
||||
|
||||
protected $prepath;
|
||||
|
||||
|
|
@ -29,7 +30,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function createPDF($id, $data){
|
||||
public function createPDF($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
|
||||
|
|
@ -57,7 +59,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
|
||||
public function createPDF_Registration(){
|
||||
public function createPDF_Registration()
|
||||
{
|
||||
$document = new stdClass();
|
||||
$document->name = 'registration';
|
||||
$document->number = $this->model->lead_id;
|
||||
|
|
@ -65,10 +68,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
$document->voucher = null;
|
||||
$document->date = now();
|
||||
$document->total = $this->model->getPriceRaw();
|
||||
|
||||
$dir = $this->getDirPath('pdf', 'booking', $document->date->format('Y'));
|
||||
$filename = "Buchnungsauftrag-" . $this->model->lead_id . ".pdf";
|
||||
|
||||
$pdf_file = new CreatePDF('pdf.booking_registration');
|
||||
$data = [
|
||||
'booking' => $this->model,
|
||||
|
|
@ -80,7 +81,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $booking_document;
|
||||
}
|
||||
|
||||
public function createPDF_Confirmation(){
|
||||
public function createPDF_Confirmation()
|
||||
{
|
||||
$document = new stdClass();
|
||||
$document->name = 'confirmation';
|
||||
$document->number = $this->model->lead_id;
|
||||
|
|
@ -92,15 +94,13 @@ class BookingPDFRepository extends BaseRepository {
|
|||
$document->deposit = $this->model->getConfirmationDeposit();
|
||||
$document->final_payment = $this->model->getConfirmationFinalPayment();
|
||||
|
||||
if ($this->model->isDepositPossible())
|
||||
{
|
||||
if ($this->model->isDepositPossible()) {
|
||||
$document->deposit_payment_date = date('Y-m-d');
|
||||
$maxDepositIntervalDays = config('booking.max_deposit_interval_days');
|
||||
$_start_date = clone $this->model->start_date;
|
||||
$_start_date->modify('-' . $maxDepositIntervalDays . ' days');
|
||||
$document->final_payment_date = $_start_date->format('Y-m-d');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$document->final_payment_date = date('Y-m-d');
|
||||
}
|
||||
$dir = $this->getDirPath('pdf', 'booking', $document->date->format('Y'));
|
||||
|
|
@ -117,7 +117,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $booking_document;
|
||||
}
|
||||
|
||||
public function createPDF_Coupon($data){
|
||||
public function createPDF_Coupon($data)
|
||||
{
|
||||
|
||||
$document = new stdClass();
|
||||
$document->name = 'coupon';
|
||||
|
|
@ -155,7 +156,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $booking_document;
|
||||
}
|
||||
|
||||
public function createPDF_Voucher($agency = false){
|
||||
public function createPDF_Voucher($agency = false)
|
||||
{
|
||||
$document = new stdClass();
|
||||
$document->name = 'voucher';
|
||||
$document->number = $this->model->lead_id;
|
||||
|
|
@ -179,7 +181,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $booking_document;
|
||||
}
|
||||
|
||||
public function createPDF_Storno($data){
|
||||
public function createPDF_Storno($data)
|
||||
{
|
||||
//Storno Values
|
||||
$storno_status_id = (int) $data['storno_status_id'];
|
||||
$storno_level = (float) $data['storno_level'];
|
||||
|
|
@ -259,13 +262,13 @@ class BookingPDFRepository extends BaseRepository {
|
|||
];
|
||||
$pdf_file->create($data, $filename, 'save', $this->prepath . $dir);
|
||||
$this->savePDF($dir, $filename, 'sterntours-template', $identifier, $document);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//get Invoice Name / Paths / ...
|
||||
private function getDirPath($file, $dir, $year){
|
||||
private function getDirPath($file, $dir, $year)
|
||||
{
|
||||
|
||||
$path = $file . '/' . $dir . '/' . $year . '/';
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
|
|
@ -274,7 +277,8 @@ class BookingPDFRepository extends BaseRepository {
|
|||
return $path;
|
||||
}
|
||||
|
||||
private function savePDF($dir, $filename, $template, $identifier, $document = null, $status = 0){
|
||||
private function savePDF($dir, $filename, $template, $identifier, $document = null, $status = 0)
|
||||
{
|
||||
|
||||
$pdfMerger = new MyPDFMerger();
|
||||
$pdfMerger->addPDF($this->prepath . $dir . $filename);
|
||||
|
|
@ -311,5 +315,3 @@ class BookingPDFRepository extends BaseRepository {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3,19 +3,21 @@
|
|||
namespace App\Repositories;
|
||||
|
||||
|
||||
use Auth;
|
||||
use App\Models\Lead;
|
||||
use App\Services\Util;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Participant;
|
||||
use App\Models\BookingNotice;
|
||||
use App\Models\BookingServiceItem;
|
||||
use App\Models\ServiceProviderEntry;
|
||||
use App\Models\BookingCompanyService;
|
||||
use App\Models\BookingCountryService;
|
||||
use App\Models\BookingDraftItem;
|
||||
use App\Models\BookingNotice;
|
||||
use App\Models\BookingProviderService;
|
||||
use App\Models\BookingServiceItem;
|
||||
use App\Models\Lead;
|
||||
use App\Models\Participant;
|
||||
use App\Models\ServiceProviderEntry;
|
||||
use App\Services\Util;
|
||||
use Auth;
|
||||
|
||||
class BookingRepository extends BaseRepository {
|
||||
class BookingRepository extends BaseRepository
|
||||
{
|
||||
|
||||
|
||||
public function __construct(Booking $model)
|
||||
|
|
@ -29,7 +31,8 @@ class BookingRepository extends BaseRepository {
|
|||
}
|
||||
|
||||
|
||||
public function updateNotice($id, $data){
|
||||
public function updateNotice($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
if ($data['action'] === 'edit_notice' && isset($data['notice_id'])) {
|
||||
|
|
@ -39,7 +42,8 @@ class BookingRepository extends BaseRepository {
|
|||
$BookingNotice->save();
|
||||
} else {
|
||||
//save_notice
|
||||
BookingNotice::create([
|
||||
BookingNotice::create(
|
||||
[
|
||||
'booking_id' => $this->model->id,
|
||||
'from_user_id' => Auth::user()->id,
|
||||
'to_user_id' => isset($this->model->sf_guard_user->user_id) ? $this->model->sf_guard_user->user_id : null,
|
||||
|
|
@ -51,7 +55,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateLeadStatus($id, $data){
|
||||
public function updateLeadStatus($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
|
||||
|
|
@ -68,7 +73,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBooking($id, $data){
|
||||
public function updateBooking($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
|
||||
|
|
@ -116,7 +122,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBookingServices($id, $data){
|
||||
public function updateBookingServices($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
if (isset($data['country_service'])) {
|
||||
|
|
@ -133,7 +140,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBookingNumber($id, $data){
|
||||
public function updateBookingNumber($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
$fill = [
|
||||
|
|
@ -145,7 +153,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBookingPrice($id, $data){
|
||||
public function updateBookingPrice($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
$fill = [
|
||||
|
|
@ -159,7 +168,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateServiceProviderEntry($id, $data){
|
||||
public function updateServiceProviderEntry($id, $data)
|
||||
{
|
||||
$this->model = Booking::findOrFail($id);
|
||||
if (isset($data['service_provider_entry'])) {
|
||||
foreach ($data['service_provider_entry'] as $spe_id => $fill) {
|
||||
|
|
@ -176,7 +186,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBookingServiceItem($id, $data){
|
||||
public function updateBookingServiceItem($id, $data)
|
||||
{
|
||||
$this->model = Booking::findOrFail($id);
|
||||
if (isset($data['booking_service_item'])) {
|
||||
foreach ($data['booking_service_item'] as $bsi_id => $fill) {
|
||||
|
|
@ -205,7 +216,8 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBookingParticipant($id, $data){
|
||||
public function updateBookingParticipant($id, $data)
|
||||
{
|
||||
$this->model = Booking::findOrFail($id);
|
||||
if (isset($data['participant'])) {
|
||||
foreach ($data['participant'] as $p_id => $fill) {
|
||||
|
|
@ -240,7 +252,8 @@ class BookingRepository extends BaseRepository {
|
|||
|
||||
|
||||
|
||||
private function updateCountryService($country_services){
|
||||
private 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();
|
||||
|
|
@ -260,7 +273,8 @@ class BookingRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
|
||||
private function updateProviderService($provider_service){
|
||||
private 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();
|
||||
|
|
@ -280,7 +294,8 @@ class BookingRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
|
||||
private function updateCompanyService($company_service){
|
||||
private 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();
|
||||
|
|
@ -300,4 +315,135 @@ class BookingRepository extends BaseRepository {
|
|||
}
|
||||
}
|
||||
|
||||
public function convertArrangementsToDrafts(Booking $booking)
|
||||
{
|
||||
if (!$booking->arrangements || $booking->arrangements->count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nextPos = 1;
|
||||
if ($booking->booking_draft_items && $booking->booking_draft_items->count() > 0) {
|
||||
$nextPos = $booking->booking_draft_items->max('pos') + 1;
|
||||
}
|
||||
|
||||
foreach ($booking->arrangements->sortByDesc('view_position') as $arrangement) {
|
||||
|
||||
$data = $arrangement->getDataAsMap();
|
||||
|
||||
|
||||
// Erstelle neues BookingDraftItem aus Arrangement
|
||||
$draftItem = new BookingDraftItem();
|
||||
|
||||
// Mappe die grundlegenden Daten
|
||||
$draftItem->booking_id = $booking->id;
|
||||
$draftItem->pos = $nextPos++;
|
||||
|
||||
// Daten von Arrangement übertragen
|
||||
if ($arrangement->begin) {
|
||||
$draftItem->start_date = $arrangement->begin->format('Y-m-d');
|
||||
}
|
||||
if ($arrangement->end) {
|
||||
$draftItem->end_date = $arrangement->end->format('Y-m-d');
|
||||
}
|
||||
|
||||
// Service/Beschreibung aus data_s generieren
|
||||
$serviceText = $arrangement->getDataS();
|
||||
$draftItem->service = $serviceText;
|
||||
|
||||
$draftItem->adult = $data['Teilnehmer'] ?? $booking->pax;
|
||||
$draftItem->price_adult = $data['Preis'] ?? 0;
|
||||
|
||||
// PDF-Einstellung übernehmen
|
||||
$draftItem->in_pdf = $arrangement->in_pdf ? 1 : 0;
|
||||
|
||||
// Versuche DraftType zu finden basierend auf ArrangementType
|
||||
if ($arrangement->arrangement_type && isset($arrangement->arrangement_type->name)) {
|
||||
$draftType = \App\Models\DraftType::where('name', 'like', '%' . $arrangement->arrangement_type->name . '%')->first();
|
||||
if ($draftType) {
|
||||
$draftItem->draft_type_id = $draftType->id;
|
||||
}
|
||||
} else {
|
||||
// Fallback: Suche nach einem passenden DraftType basierend auf dem Namen
|
||||
$draftType = \App\Models\DraftType::where('name', 'like', '%' . $arrangement->type_s . '%')->first();
|
||||
if ($draftType) {
|
||||
$draftItem->draft_type_id = $draftType->id;
|
||||
}
|
||||
}
|
||||
|
||||
// Standardwerte für neue Felder setzen
|
||||
$draftItem->comfort = 0;
|
||||
$draftItem->price = 0;
|
||||
$draftItem->adult = 0;
|
||||
$draftItem->price_children = 0;
|
||||
$draftItem->children = 0;
|
||||
|
||||
$draftItem->save();
|
||||
|
||||
// Arrangement als konvertiert markieren oder löschen
|
||||
// Hier löschen wir das Arrangement nach erfolgreicher Konvertierung
|
||||
$arrangement->delete();
|
||||
}
|
||||
|
||||
// Stelle sicher, dass new_drafts aktiviert ist
|
||||
if (!$booking->new_drafts) {
|
||||
$booking->new_drafts = true;
|
||||
$booking->save();
|
||||
}
|
||||
|
||||
// Preise neu berechnen
|
||||
$booking->calculate_price_total();
|
||||
}
|
||||
|
||||
public function loadDraftToBooking($bookingId, $draftId)
|
||||
{
|
||||
$booking = Booking::findOrFail($bookingId);
|
||||
$draft = \App\Models\Draft::findOrFail($draftId);
|
||||
|
||||
if (!$booking->new_drafts) {
|
||||
$booking->new_drafts = true;
|
||||
$booking->save();
|
||||
}
|
||||
|
||||
// Lösche bestehende Draft Items falls gewünscht
|
||||
if ($booking->booking_draft_items && $booking->booking_draft_items->count() > 0) {
|
||||
foreach ($booking->booking_draft_items as $existingItem) {
|
||||
$existingItem->delete();
|
||||
}
|
||||
}
|
||||
|
||||
$pos = 1;
|
||||
foreach ($draft->draft_items as $draftItem) {
|
||||
$bookingDraftItem = new \App\Models\BookingDraftItem();
|
||||
|
||||
// Kopiere alle Daten aus der Draft Vorlage
|
||||
$bookingDraftItem->booking_id = $booking->id;
|
||||
$bookingDraftItem->draft_type_id = $draftItem->draft_type_id;
|
||||
$bookingDraftItem->travel_program_id = null; // Wird später gesetzt wenn nötig
|
||||
$bookingDraftItem->fewo_lodging_id = null;
|
||||
$bookingDraftItem->travel_class_id = null;
|
||||
$bookingDraftItem->draft_item_id = $draftItem->id;
|
||||
$bookingDraftItem->request_date = null;
|
||||
$bookingDraftItem->days_start = $draftItem->days_start;
|
||||
$bookingDraftItem->days_duration = $draftItem->days_duration;
|
||||
$bookingDraftItem->start_date = null; // Wird später basierend auf Reisebeginn gesetzt
|
||||
$bookingDraftItem->end_date = null; // Wird später basierend auf Reiseende gesetzt
|
||||
$bookingDraftItem->service = $draftItem->service;
|
||||
$bookingDraftItem->price_adult = $draftItem->price_adult;
|
||||
$bookingDraftItem->adult = $draftItem->adult;
|
||||
$bookingDraftItem->price_children = $draftItem->price_children;
|
||||
$bookingDraftItem->children = $draftItem->children;
|
||||
$bookingDraftItem->price = 0; // Wird später berechnet
|
||||
$bookingDraftItem->pos = $pos++;
|
||||
$bookingDraftItem->in_pdf = $draftItem->in_pdf;
|
||||
$bookingDraftItem->comfort = 0;
|
||||
$bookingDraftItem->status = 1;
|
||||
|
||||
$bookingDraftItem->save();
|
||||
}
|
||||
|
||||
// Preise neu berechnen
|
||||
$booking->calculate_price_total();
|
||||
|
||||
return $booking;
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"php": "^8.0|^8.2",
|
||||
"bacon/bacon-qr-code": "^3.0",
|
||||
"barryvdh/laravel-dompdf": "*",
|
||||
"cviebrock/eloquent-sluggable": "*",
|
||||
|
|
|
|||
932
composer.lock
generated
113
docker-compose.yml
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
services:
|
||||
laravel.test:
|
||||
build:
|
||||
context: ./vendor/laravel/sail/runtimes/8.2
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
WWWGROUP: '${WWWGROUP}'
|
||||
image: sail-8.2/app
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
ports:
|
||||
#- '${APP_PORT:-80}:80'
|
||||
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
|
||||
environment:
|
||||
WWWUSER: '${WWWUSER}'
|
||||
LARAVEL_SAIL: 1
|
||||
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
|
||||
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
|
||||
IGNITION_LOCAL_SITES_PATH: '${PWD}'
|
||||
volumes:
|
||||
- '.:/var/www/html'
|
||||
networks:
|
||||
- sail
|
||||
- proxy
|
||||
depends_on:
|
||||
- mysql
|
||||
- mysql-stern
|
||||
- redis
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Hauptdomain
|
||||
- "traefik.http.routers.meinsterntours.rule=Host(`mein.sterntours.test`)"
|
||||
- "traefik.http.routers.meinsterntours.entrypoints=websecure"
|
||||
- "traefik.http.routers.meinsterntours.tls=true"
|
||||
- "traefik.http.routers.meinsterntours.service=meinsterntours-service"
|
||||
# Service Definition - NUR EINMAL!
|
||||
- "traefik.http.services.meinsterntours-service.loadbalancer.server.port=80"
|
||||
- "traefik.docker.network=proxy"
|
||||
mysql:
|
||||
image: 'mysql/mysql-server:8.0'
|
||||
ports:
|
||||
- '${FORWARD_DB_PORT:-33064}:3306'
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
|
||||
MYSQL_ROOT_HOST: '%'
|
||||
MYSQL_DATABASE: '${DB_DATABASE}'
|
||||
MYSQL_USER: '${DB_USERNAME}'
|
||||
MYSQL_PASSWORD: '${DB_PASSWORD}'
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||
volumes:
|
||||
- 'sail-mysql:/var/lib/mysql'
|
||||
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
|
||||
networks:
|
||||
- sail
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- mysqladmin
|
||||
- ping
|
||||
- '-p${DB_PASSWORD}'
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
mysql-stern:
|
||||
image: 'mysql/mysql-server:8.0'
|
||||
ports:
|
||||
- '${FORWARD_DB_PORT_STERN:-33065}:3306'
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD_STERN}'
|
||||
MYSQL_ROOT_HOST: '%'
|
||||
MYSQL_DATABASE: '${DB_DATABASE_STERN}'
|
||||
MYSQL_USER: '${DB_USERNAME_STERN}'
|
||||
MYSQL_PASSWORD: '${DB_PASSWORD_STERN}'
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||
volumes:
|
||||
- 'sail-mysql-stern:/var/lib/mysql'
|
||||
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
|
||||
networks:
|
||||
- sail
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- mysqladmin
|
||||
- ping
|
||||
- '-p${DB_PASSWORD_STERN}'
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
redis:
|
||||
image: 'redis:alpine'
|
||||
ports:
|
||||
- '${FORWARD_REDIS_PORT:-6379}:6379'
|
||||
volumes:
|
||||
- 'sail-redis:/data'
|
||||
networks:
|
||||
- sail
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- redis-cli
|
||||
- ping
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
networks:
|
||||
sail:
|
||||
driver: bridge
|
||||
proxy:
|
||||
external: true
|
||||
volumes:
|
||||
sail-mysql:
|
||||
driver: local
|
||||
sail-mysql-stern:
|
||||
driver: local
|
||||
sail-redis:
|
||||
driver: local
|
||||
|
|
@ -3,6 +3,5 @@
|
|||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
]
|
||||
}
|
||||
0
public/128.jpg
Normal file → Executable file
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
public/css/application-purple.css
Normal file → Executable file
0
public/css/application.css
Normal file → Executable file
0
public/css/stern_fewo_pdf.css
Normal file → Executable file
0
public/fonts/nunito.css
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
0
public/fonts/nunito/nunito-v25-latin-200.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-200italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-200italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
0
public/fonts/nunito/nunito-v25-latin-300.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-300italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-300italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
0
public/fonts/nunito/nunito-v25-latin-500.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-500italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-500italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
0
public/fonts/nunito/nunito-v25-latin-600.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-600italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-600italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
0
public/fonts/nunito/nunito-v25-latin-700.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-700italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-700italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
0
public/fonts/nunito/nunito-v25-latin-800.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
0
public/fonts/nunito/nunito-v25-latin-800italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-800italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
0
public/fonts/nunito/nunito-v25-latin-900.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
0
public/fonts/nunito/nunito-v25-latin-900italic.ttf
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900italic.woff
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-900italic.woff2
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-italic.eot
Normal file → Executable file
0
public/fonts/nunito/nunito-v25-latin-italic.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |