This commit is contained in:
Kevin Adametz 2024-08-05 11:58:09 +02:00
parent c1c613a4b9
commit 881fc84207
384 changed files with 50679 additions and 990 deletions

2
.env
View file

@ -11,6 +11,8 @@ APP_URL_V2=https://v2.sterntours.test
#APP_URL_STERN=https://www.sterntours.de #APP_URL_STERN=https://www.sterntours.de
APP_URL_STERN=https://sterntours.test APP_URL_STERN=https://sterntours.test
APP_DOMAIN_TLD=test
LOG_CHANNEL=stack LOG_CHANNEL=stack
DB_CONNECTION=mysql DB_CONNECTION=mysql

234
app/Helper/Booking.php Normal file
View file

@ -0,0 +1,234 @@
<?php
namespace App\Helper;
use App\Models\BookingDocument;
class BookingDocument
{
private static $files_count = 0;
public static function getFilesCount(){
return self::$files_count++;
}
public static function getBookingDocumentsHTMLTable($identifier, $booking){
$ret = "";
$files = self::getV2BookingDocuments($identifier, $booking);
if($files){
$ret .= self::makeHTMLTable($files, $identifier, 'v2');
}
return $ret;
//TODO !!! v3 save data and output
$files = self::getBookingDocuments($identifier, $booking->id);
if($files){
$ret .= self::makeHTMLTable($files, $identifier, 'v3');
}else{
$files = self::getV2BookingDocuments($identifier, $booking);
if($files){
$ret .= self::makeHTMLTable($files, $identifier, 'v2');
}
}
return $ret;
}
public static function getBookingDocuments($identifier, $booking_id){
switch($identifier){
case 'registration':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'registration')->get();
break;
case 'confirmation':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'confirmation')->get();
break;
case 'storno':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'storno')->get();
break;
case 'coupon':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'coupon')->get();
break;
case 'voucher':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'voucher')->get();
break;
case 'voucher_agency':
$files = BookingDocument::where('booking_id', $booking_id)->where('identifier', 'voucher_agency')->get();
break;
default:
$files = null;
}
return $files;
}
public static function getV2BookingDocuments($identifier, $booking){
switch($identifier){
case 'registration':
$files = $booking->booking_applications;
break;
case 'confirmation':
$files = $booking->booking_confirmations;
break;
case 'storno':
$files = $booking->booking_stornos;
break;
case 'coupon':
$files = $booking->coupons;
break;
case 'voucher':
$files = $booking->booking_vouchers;
break;
case 'voucher_agency':
$files = $booking->booking_voucher_agencys;
break;
default:
$files = null;
}
return $files;
}
private static function makeHTMLTable($files, $identifier, $version){
$ret = "";
foreach($files as $file){
;
if($version === 'v2'){
$file_details = self::getV2FileDetails($file, $identifier);
}
if($version === 'v3'){
$file_details = self::getV2FileDetails($file, $identifier);
}
if(isset($file_details)){
$ret .= "<tr>";
$ret .= "<th scope='row'>".self::getFilesCount()."</th>";
$ret .= "<td>";
$ret .= "<a href='".route('customer_file_show', [$identifier, $file->id])."' target='_blank' class='badge badge-md badge-".$file_details->color."'>";
$ret .= "<i class='fa fa-file-pdf mr-1'></i> ".$file_details->name;
$ret .= "</a>";
$ret .= "</td>";
$ret .= "<td>".$file_details->cell."</td>";
$ret .= "<td>".$file_details->date."</td>";
$ret .= "<td>";
$ret .= "<a href='".route('customer_file_show', [$identifier, $file->id, true])."' class='btn btn-xs btn-default' title='Download' data-placement='left' rel='tooltip'>";
$ret .= "<i class='fa fa-download'></i>";
$ret .= "</a>";
$ret .= "</td>";
$ret .= "</tr>";
}
}
return $ret;
}
private static function getV3FileDetails($file, $identifier){
$ret = new \stdClass();
switch($identifier){
case 'registration':
$ret->name = "Reiseanmeldung";
$ret->color = "primary";
$ret->cell = "Reise | Gesamtpreis: ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'confirmation':
$ret->name = "Reisebestätigung";
$ret->color = "success";
$ret->cell = "Reise | Gesamtpreis: ".\App\Services\Util::_number_format($file->total)." &euro; <br>
Anzahlung: ".\App\Services\Util::_number_format($file->deposit)." &euro; <br>
Restzahlung: ".\App\Services\Util::_number_format($file->final_payment)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'storno':
$ret->name = "Stornobestätigung";
$ret->color = "danger";
$ret->cell = "Storno | Betrag: ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'coupon':
$ret->name = "Gutschein ".$file->number;
$ret->color = "danger";
$ret->cell = "Gutschein | Wert: ".\App\Services\Util::_number_format($file->value)." &euro; |
bis: ".\App\Services\Util::_format_date($file->valid_date, 'date')." |
".(($file->is_redeemed) ? '<i class="fa fa-check-circle text-success"></i> '.\App\Services\Util::_format_date($file->redeem_date, 'date') : '<i class="fa fa-times-circle text-danger"></i>')."";
$ret->date = \App\Services\Util::_format_date($file->issue_date, 'date');
break;
case 'voucher':
$ret->name = " Voucher ID ".$file->id;
$ret->color = "dark";
$ret->cell = " Voucher für den Kunden";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'voucher_agency':
$ret->name = "Voucher-Agentur ID ".$file->id;
$ret->color = "dark";
$ret->cell = "Voucher für die Agentur";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
default:
$ret->name = "";
$ret->color = "";
$ret->cell = "";
$ret->date = "";
}
return $ret;
return $ret;
}
private static function getV2FileDetails($file, $identifier){
$ret = new \stdClass();
switch($identifier){
case 'registration':
$ret->name = "Reiseanmeldung";
$ret->color = "primary";
$ret->cell = "Reise | Gesamtpreis: ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'confirmation':
$ret->name = "Reisebestätigung";
$ret->color = "success";
$ret->cell = "Reise | Gesamtpreis: ".\App\Services\Util::_number_format($file->total)." &euro; <br>
Anzahlung: ".\App\Services\Util::_number_format($file->deposit)." &euro; <br>
Restzahlung: ".\App\Services\Util::_number_format($file->final_payment)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'storno':
$ret->name = "Stornobestätigung";
$ret->color = "danger";
$ret->cell = "Storno | Betrag: ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'coupon':
$ret->name = "Gutschein ".$file->number;
$ret->color = "danger";
$ret->cell = "Gutschein | Wert: ".\App\Services\Util::_number_format($file->value)." &euro; |
bis: ".\App\Services\Util::_format_date($file->valid_date, 'date')." |
".(($file->is_redeemed) ? '<i class="fa fa-check-circle text-success"></i> '.\App\Services\Util::_format_date($file->redeem_date, 'date') : '<i class="fa fa-times-circle text-danger"></i>')."";
$ret->date = \App\Services\Util::_format_date($file->issue_date, 'date');
break;
case 'voucher':
$ret->name = " Voucher ID ".$file->id;
$ret->color = "dark";
$ret->cell = " Voucher für den Kunden";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'voucher_agency':
$ret->name = "Voucher-Agentur ID ".$file->id;
$ret->color = "dark";
$ret->cell = "Voucher für die Agentur";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
default:
$ret->name = "";
$ret->color = "";
$ret->cell = "";
$ret->date = "";
}
return $ret;
}
}

View file

@ -0,0 +1,313 @@
<?php
namespace App\Helper;
use App\Models\Booking;
use App\Models\BookingDocument as BookingDocumentModel;
class BookingDocument
{
private static $files_count = 0;
public static function showButton($identifier, Booking $booking){
switch($identifier){
case 'registration':
return $booking->price > 0 ? true : false;
break;
case 'confirmation':
return $booking->hasDocument('registration') > 0 ? true : false;
break;
case 'storno':
return $booking->hasDocument('confirmation') > 0 ? true : false;
break;
case 'coupon':
return $booking->hasDocument('confirmation') > 0 ? true : false;
case 'voucher':
return $booking->hasDocument('confirmation') > 0 ? true : false;
case 'voucher_agency':
return $booking->hasDocument('confirmation') > 0 ? true : false;
}
return false;
}
/*
functions to make the html table for the booking documents
*/
public static function getFilesCount(){
return self::$files_count++;
}
public static function getBookingDocumentsHTMLTable($identifier, Booking $booking, $look = 'show'){
$ret = "";
$files = self::getBookingDocuments($identifier, $booking->id);
if($files && $files->count() > 0){
$ret .= self::makeHTMLTable($files, $identifier, 'v3', $look);
}
$files = self::getV2BookingDocuments($identifier, $booking);
if($files && $files->count() > 0){
$ret .= self::makeHTMLTable($files, $identifier, 'v2', $look);
}
return $ret;
}
public static function getBookingDocuments($identifier, $booking_id){
switch($identifier){
case 'registration':
$files = BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'registration')->get();
break;
case 'confirmation':
$files = BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'confirmation')->get();
break;
case 'storno':
$files = null; //BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'storno')->get();
break;
case 'coupon':
$files = null; //BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'coupon')->get();
break;
case 'voucher':
$files = BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'voucher')->get();
break;
case 'voucher_agency':
$files = BookingDocumentModel::where('booking_id', $booking_id)->where('identifier', 'voucher_agency')->get();
break;
default:
$files = null;
}
return $files;
}
public static function getV2BookingDocuments($identifier, Booking $booking){
switch($identifier){
case 'registration':
$files = $booking->booking_applications;
break;
case 'confirmation':
$files = $booking->booking_confirmations;
break;
case 'storno':
$files = $booking->booking_stornos;
break;
case 'coupon':
$files = $booking->coupons;
break;
case 'voucher':
$files = $booking->booking_vouchers;
break;
case 'voucher_agency':
$files = $booking->booking_voucher_agencys;
break;
default:
$files = null;
}
return $files;
}
private static function makeHTMLTable($files, $identifier, $version, $look){
$ret = "";
foreach($files as $file){
;
if($version === 'v2'){
$file_details = self::getV2FileDetails($file, $identifier, $look);
}
if($version === 'v3'){
$file_details = self::getV3FileDetails($file, $identifier, $look);
}
if(isset($file_details)){
$ret .= "<tr>";
$ret .= "<th scope='row'>".self::getFilesCount()."</th>";
$ret .= "<td>";
$ret .= "<a href='".$file_details->route."' target='_blank' class='badge badge-md badge-".$file_details->color."'>";
$ret .= "<i class='fa fa-file-pdf mr-1 ".(($file_details->opacity) ? 'opacity-50' : '')."'></i> ".$file_details->name;
$ret .= "</a>";
$ret .= "</td>";
$ret .= "<td>".$file_details->cell."</td>";
$ret .= "<td>".$file_details->date."</td>";
$ret .= "<td>";
if($look === 'show'){
$ret .= "<a href='".$file_details->donwload."' class='btn btn-xs btn-default' title='Download' data-placement='left' rel='tooltip'>";
$ret .= "<i class='fa fa-download'></i>";
$ret .= "</a>";
}
if($look === 'mail'){
$ret .= "<button data-target='".$file_details->route."' data-name='".$file_details->name.".pdf' class='btn btn-xs btn-primary add-file-to-attachment'";
$ret .= " title='als Anhang hinzufügen' data-placement='left' rel='tooltip'>";
$ret .= "<i class='fa fa-cloud-download-alt'></i>";
$ret .= "</button>";
}
$ret .= "</td>";
$ret .= "</tr>";
}
}
return $ret;
}
private static function getV3FileDetails($file, $identifier, $look){
$ret = new \stdClass();
switch($identifier){
case 'registration':
$ret->name = "Buchnungsauftrag ".$file->data->number;
$ret->color = "primary";
$ret->cell = self::getCellLabel($look, 'GP').": ".\App\Services\Util::_number_format((float) $file->data->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->data->date, 'date');
break;
case 'confirmation':
$ret->name = "Reisebestätigung ".$file->data->number;
$ret->color = "success";
$ret->cell = self::getCellLabel($look, 'GP').": ".\App\Services\Util::_number_format($file->data->total)." &euro; <br>
".self::getCellLabel($look, 'AZ').": ".\App\Services\Util::_number_format($file->data->deposit)." &euro; <br>
".self::getCellLabel($look, 'RZ').": ".\App\Services\Util::_number_format($file->data->final_payment)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->data->date, 'date');
break;
case 'storno':
$ret->name = "Stornobestätigung ".$file->data->number;
$ret->color = "danger";
$ret->cell = self::getCellLabel($look, 'SB').": ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->data->date, 'date');
break;
case 'coupon':
$ret->name = "Gutschein ".$file->number;
$ret->color = "warning";
$ret->cell = self::getCellLabel($look, 'GW').": ".\App\Services\Util::_number_format($file->value)." &euro; |
bis: ".\App\Services\Util::_format_date($file->valid_date, 'date')." |
".(($file->is_redeemed) ? '<i class="fa fa-check-circle text-success"></i> '.\App\Services\Util::_format_date($file->redeem_date, 'date') : '<i class="fa fa-times-circle text-danger"></i>')."";
$ret->date = \App\Services\Util::_format_date($file->issue_date, 'date');
break;
case 'voucher':
$ret->name = " Voucher ".$file->data->number;
$ret->color = "dark";
$ret->cell = self::getCellLabel($look, 'VC');
$ret->date = \App\Services\Util::_format_date($file->data->date, 'date');
break;
case 'voucher_agency':
$ret->name = "Voucher-Agentur ".$file->data->number;
$ret->color = "dark";
$ret->cell = self::getCellLabel($look, 'VA');
$ret->date = \App\Services\Util::_format_date($file->data->date, 'date');
break;
default:
$ret->name = "";
$ret->color = "";
$ret->cell = "";
$ret->date = "";
}
$ret->route = $file->getURL('file');
$ret->donwload = $file->getURL('download');
$ret->opacity = false;
return $ret;
}
private static function getV2FileDetails($file, $identifier, $look){
$ret = new \stdClass();
switch($identifier){
case 'registration':
$ret->name = "Reiseanmeldung";
$ret->color = "primary";
$ret->cell = self::getCellLabel($look, 'GP').": ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'confirmation':
$ret->name = "Reisebestätigung";
$ret->color = "success";
$ret->cell = self::getCellLabel($look, 'GP').": ".\App\Services\Util::_number_format($file->total)." &euro; <br>
".self::getCellLabel($look, 'AZ').": ".\App\Services\Util::_number_format($file->deposit)." &euro; <br>
".self::getCellLabel($look, 'RZ').": ".\App\Services\Util::_number_format($file->final_payment)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'storno':
$ret->name = "Stornobestätigung";
$ret->color = "danger";
$ret->cell = self::getCellLabel($look, 'SB').": ".\App\Services\Util::_number_format($file->total)." &euro;";
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
if($file->booking_document){
$ret->name .= " ".$file->booking_document->data->number;
$ret->cell = self::getCellLabel($look, 'SB').": ".\App\Services\Util::_number_format($file->storno)." &euro;";
$ret->route = $file->booking_document->getURL('file');
$ret->donwload = $file->booking_document->getURL('download');
$ret->opacity = false;
return $ret;
}
break;
case 'coupon':
$ret->name = "Gutschein ".$file->number;
$ret->color = "warning";
$ret->cell = self::getCellLabel($look, 'GW').": ".\App\Services\Util::_number_format($file->value)." &euro; |
bis: ".\App\Services\Util::_format_date($file->valid_date, 'date')." |
".(($file->is_redeemed) ? '<i class="fa fa-check-circle text-success"></i> '.\App\Services\Util::_format_date($file->redeem_date, 'date') : '<i class="fa fa-times-circle text-danger"></i>')."";
$ret->date = \App\Services\Util::_format_date($file->issue_date, 'date');
if($file->booking_document){
$ret->route = $file->booking_document->getURL('file');
$ret->donwload = $file->booking_document->getURL('download');
$ret->opacity = false;
return $ret;
}
break;
case 'voucher':
$ret->name = " Voucher ID ".$file->id;
$ret->color = "dark";
$ret->cell = self::getCellLabel($look, 'VC');
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
case 'voucher_agency':
$ret->name = "Voucher-Agentur ID ".$file->id;
$ret->color = "dark";
$ret->cell = self::getCellLabel($look, 'VA');
$ret->date = \App\Services\Util::_format_date($file->updated_at, 'date');
break;
default:
$ret->name = "";
$ret->color = "";
$ret->cell = "";
$ret->date = "";
}
$ret->route = route('customer_file_show', [$identifier, $file->id]);
$ret->donwload = route('customer_file_show', [$identifier, $file->id, true]);
$ret->opacity = true;
return $ret;
}
public static function getCellLabel($look, $identifier){
switch($identifier){
case 'GP':
return $look === 'mail' ? 'GP' : 'Reise | Gesamtpreis';
break;
case 'AZ':
return $look === 'mail' ? 'AZ' : 'Anzahlung';
break;
case 'RZ':
return $look === 'mail' ? 'RZ' : 'Restzahlung';
break;
case 'SB':
return $look === 'mail' ? 'GB' : 'Storno | Betrag';
break;
case 'GW':
return $look === 'mail' ? 'W' : 'Gutschein | Wert';
break;
case 'VC':
return $look === 'mail' ? 'für Kunden' : 'Voucher für den Kunden';
break;
case 'VA':
return $look === 'mail' ? 'für Agentur' : 'Voucher für die Agentur';
break;
}
}
}

View file

@ -1,10 +1,8 @@
<?php <?php
namespace App\Services; namespace App\Helper;
use Form;
use App\Models\Draft; use App\Models\Draft;
use App\Models\Airline; use App\Models\Airline;
use App\Models\Country;
use App\Models\CMSAuthor; use App\Models\CMSAuthor;
use App\Models\DraftType; use App\Models\DraftType;
use App\Models\Insurance; use App\Models\Insurance;
@ -19,7 +17,6 @@ use App\Models\IQTravelGroup;
use App\Models\TravelCompany; use App\Models\TravelCompany;
use App\Models\TravelCountry; use App\Models\TravelCountry;
use App\Models\TravelProgram; use App\Models\TravelProgram;
use App\Models\IQTravelGroupItem;
use App\Models\TravelNationality; use App\Models\TravelNationality;
use App\Models\TravelBookingFewoChannel; use App\Models\TravelBookingFewoChannel;
@ -134,6 +131,18 @@ class HTMLHelper
} }
public static function getSelectedOptions($values, $id = null, $empty = false){
$ret = "";
if($empty){
$ret .= '<option value="">'.$empty.'</option>\n';
}
foreach ($values as $key => $value){
$attr = ($key == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
public static function getActiveIcon($active){ public static function getActiveIcon($active){
return $active ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>'; return $active ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
} }
@ -157,7 +166,6 @@ class HTMLHelper
return $ret; return $ret;
} }
public static function getYearSelectOptions(){ public static function getYearSelectOptions(){
$start = date("Y", strtotime("-5 years", time())); $start = date("Y", strtotime("-5 years", time()));
$end = date("Y", strtotime("+1 years", time())); $end = date("Y", strtotime("+1 years", time()));
@ -475,11 +483,13 @@ class HTMLHelper
foreach ($images as $image) { foreach ($images as $image) {
$src = $image->getAttribute('src'); $src = $image->getAttribute('src');
$host = config('app.url_stern'); if(strpos($src, 'http') === false){
if(strpos($src, $host) === false){ $host = config('app.url_stern');
$src = $host."/".ltrim($src, '/'); if(strpos($src, $host) === false){
$src = $host."/".ltrim($src, '/');
}
$image->setAttribute('src', $src);
} }
$image->setAttribute('src', $src);
} }
} }

View file

@ -1,11 +1,11 @@
<?php <?php
namespace App\Services; namespace App\Helper;
use App\Models\IQContentSiteField; use App\Models\IQContentSiteField;
use App\Models\IQContentTree; use App\Models\IQContentTree;
use App\Models\IQContentTreeNode; use App\Models\IQContentTreeNode;
class HTMLTreeHelper class TreeHTML
{ {
private static $uri = null; private static $uri = null;
@ -113,6 +113,7 @@ class HTMLTreeHelper
<h6 class="small font-weight-bold text-expanded text-uppercase">'.$categories.'</h6>'; <h6 class="small font-weight-bold text-expanded text-uppercase">'.$categories.'</h6>';
} else { } else {
/*
$site_field = IQContentSiteField::findSiteField($node, 'main-navi', 'menu-navi-image'); $site_field = IQContentSiteField::findSiteField($node, 'main-navi', 'menu-navi-image');
$img_src = (isset($site_field->content) ? $site_field->content : '/images/navi_images-assets/titelbild.jpg'); $img_src = (isset($site_field->content) ? $site_field->content : '/images/navi_images-assets/titelbild.jpg');
@ -120,6 +121,7 @@ class HTMLTreeHelper
<img src="'.$img_src.'" alt="" class="d-block ui-w-60"> <img src="'.$img_src.'" alt="" class="d-block ui-w-60">
<span class="media-body font-weight-semibold ml-2">' . ($link == $node->identifier ? '<strong>' : '') . $node->name . '</span>' . ($link == $node->identifier ? '</strong>' : '') . ' <span class="media-body font-weight-semibold ml-2">' . ($link == $node->identifier ? '<strong>' : '') . $node->name . '</span>' . ($link == $node->identifier ? '</strong>' : '') . '
</a>'; </a>';
*/
} }
if ($children && $lvl == 0) { if ($children && $lvl == 0) {

View file

@ -6,7 +6,7 @@ use App\Http\Controllers\Controller;
use App\Models\CMSInfo; use App\Models\CMSInfo;
use App\Models\CMSInfoAvailable; use App\Models\CMSInfoAvailable;
use App\Models\CMSInfoHoliday; use App\Models\CMSInfoHoliday;
use App\Services\HTMLHelper; use App\Helper\HTMLHelper;
class CMSContentInfoController extends Controller class CMSContentInfoController extends Controller

View file

@ -30,8 +30,15 @@ class UserController extends Controller
return response()->json(['error' => 'Unauthorised'], 401); return response()->json(['error' => 'Unauthorised'], 401);
} }
return response()->json(['error' => 'Unauthorised', 'email' => request('email')], 401);
} }
public function test()
{
return "testing";
}
/** /**
* Register api * Register api
* api.mein.sterntours.de * api.mein.sterntours.de

View file

@ -0,0 +1,396 @@
<?php
namespace App\Http\Controllers\Admin;
use Request;
use Carbon\Carbon;
use App\Models\Status;
use App\Services\Util;
use App\Models\Booking;
use App\Models\TravelCompany;
use App\Http\Controllers\Controller;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\ReportCollectionExport;
class ReportBookingController extends Controller
{
public function __construct()
{
$this->middleware(['superadmin', '2fa']);
}
public function bookings()
{
$data = [
'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(),
'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(),
];
return view('admin.report.bookings', $data);
}
public function checkBookings()
{
$data = [
'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(),
'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(),
];
return view('admin.report.check_bookings', $data);
}
//checkBookingsDatatable
private function prozessBookingSearch()
{
$query = Booking::with( 'customer', 'lead', 'booking_strono','service_provider_entries', 'service_provider_entries.service_provider')->select('booking.*');
if(Request::get('filter_db_lead_status_id') != ""){
$query->whereHas('lead', function ($q) {
$q->whereIn('status_id', Request::get('filter_db_lead_status_id'));
});
}
if(Request::get('filter_lead_status_id') != ""){
$query->whereHas('lead', function ($q) {
$q->whereIn('status_id', Request::get('filter_lead_status_id'));
});
}
if(Request::get('filter_travel_company_id') != ""){
$query->whereIn("travel_company_id", Request::get('filter_travel_company_id'));
}
if(Request::get('filter_travel_date_from') != ""){
$travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d");
$query->where("start_date", '>=', $travel_date_from);
}
if(Request::get('filter_travel_date_to') != ""){
$travel_date_to = Carbon::parse(Request::get('filter_travel_date_to'))->format("Y-m-d");
$query->where("start_date", '<=', $travel_date_to);
}
if(Request::get('filter_booking_date_from') != ""){
$filter_booking_date_from = Carbon::parse(Request::get('filter_booking_date_from'))->format("Y-m-d");
$query->where("booking_date", '>=', $filter_booking_date_from);
}
if(Request::get('filter_booking_date_to') != ""){
$filter_booking_date_from = Carbon::parse(Request::get('filter_booking_date_to'))->format("Y-m-d");
$query->where("booking_date", '<=', $filter_booking_date_from);
}
return $query;
}
public function bookingsDatatable()
{
$query = $this->prozessBookingSearch();
return \DataTables::eloquent($query)
->with('price_total_sum', function() use ($query) {
$price1 = with(clone $query)->whereNull('canceled')->sum('price');
$price2 = with(clone $query)->whereNotNull('canceled')->sum('price_canceled');
return Util::_number_format($price1+$price2);
})
->with('price_total_total_sum', function() use ($query) {
return Util::_number_format($query->sum('price_total'));
})
->with('proceed_total_sum', function() use ($query) {
if($query->count() > 200){
return 'max 200 ';
}
$all = $query->get();
$proceeds = 0;
foreach ($all as $v){
$proceeds += $v->proceeds(true);
}
return Util::_number_format($proceeds);
})
->addColumn('id', function (Booking $booking) {
return '<a data-order="' . $booking->id . '" href="' . route('booking_detail', [$booking->id]) . '" data-id="' . $booking->id . '">' . $booking->id . '</a>';
})
->addColumn('customer.fullName', function (Booking $booking) {
return $booking->customer->fullName();
})
->addColumn('price', function (Booking $booking) {
return $booking->booking_strono ? $booking->price_canceled : $booking->price;
})
->addColumn('proceeds', function (Booking $booking) {
return $booking->proceeds();
})
->addColumn('start_date', function (Booking $booking) {
return $booking->getStartDateFormat();
})
->addColumn('end_date', function (Booking $booking) {
return $booking->getEndDateFormat();
})
->addColumn('booking_date', function (Booking $booking) {
return $booking->getBookingDateFormat();
})
->addColumn('booking_strono_date', function (Booking $booking) {
return $booking->booking_strono ? $booking->booking_strono->storno_date->format("d.m.Y") : "";
})
->addColumn('service_provider.names', function (Booking $booking) {
$ret = "";
if($booking->service_provider_entries){
foreach ($booking->service_provider_entries as $service_provider_entry){
$ret .= '<span class="ui-stars">'.$service_provider_entry->service_provider->name." | ";
$ret .= $service_provider_entry->getAmountFinalEur()." | ";
$ret .= $service_provider_entry->is_cleared ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>';
$ret .= "</span><br>";
}
}
return $ret === "" ? "-" : $ret;
})
->addColumn('lead.status_id', function (Booking $booking) {
if($booking->lead && $booking->lead->status_id){
$color = $booking->lead->status->color;
$icon = "";
if($booking->lead->status_id == 14 && $booking->lead->is_rebook){
$color = '#94ae59';
$icon = '<i class="fa fa-check-circle"></i> ';
}
if($booking->lead->status_id == 14 && !$booking->lead->is_rebook){
$icon = '<i class="fa fa-times-circle"></i> ';
}
return '<span data-order="'.$booking->lead->status_id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$booking->lead->status->name.'</span></span>';
}
return '<span data-order="0">-</span>';
})
->filterColumn('customer.fullName', function ($query, $keyword) {
if ($keyword != "") {
$query->whereHas('customer', function ($q) use ($keyword) {
$q->where("name", 'LIKE', '%' . $keyword . '%')
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
});
}
})
->orderColumn('id', 'id $1')
->orderColumn('start_date', 'start_date $1')
->orderColumn('end_date', 'end_date $1')
->orderColumn('price', 'price $1')
->orderColumn('booking_date', 'booking_date $1')
->orderColumn('customer.fullName', 'customer.firstname $1')
->orderColumn('customer.firstname', 'customer.firstname $1')
->orderColumn('customer.name', 'customer.name $1')
//->orderColumn('lead.status_id', 'lead.status_id $1')
//->orderColumn('is_cleared', 'is_cleared $1')
->rawColumns(['id', 'lead.status_id', 'service_provider.names'])
->make(true);
}
public function bookingsExport(){
$query = $this->prozessBookingSearch();
$order = explode(",", Request::get('order'));
$orderByNum = [
0 => "id",
2 => "merlin_order_number",
3 => "price",
4 => "price_total",
7 => "start_date",
8 => "end_date",
9 => "booking_date",
];
if(isset($order[0])) {
$column = isset($orderByNum[$order[0]]) ? $orderByNum[$order[0]] : "start_date";
$direction = isset($order[1]) ? strtoupper($order[1]) : "ASC";
$query->orderBy($column, $direction);
}
$filename = "file-".date('Y-m-d-H-i-s');
$exports = $query->get();
$columns = [];
if(Request::get('export') === "export"){
$filename = "Buchungen_".date('Y-m-d-H-i-s');
$headers = array(
'BuchungsID',
'Status',
'Storno',
'MyJack Nr.',
'Organisation',
'Reisepreis',
'Erlös',
'Kunde',
'Reisedatum',
'bis',
'Buchungsdatum',
'Reiseland',
'Reiseprogramm',
'Reiseteilnehmer',
'Leistungsträger',
'Zahlung',
'Zahlungsdatum',
'Rechnungsnummer',
'abgeschlossen',
);
$total_price = 0;
$total_price_total = 0;
$total_proceeds = 0;
$total_amount_final = 0;
foreach($exports as $export) {
$storno_date = $export->booking_strono ? $export->booking_strono->storno_date->format("d.m.Y") : "";
if($export->service_provider_entries->count()){
$new = true;
foreach ($export->service_provider_entries as $service_provider_entry){
if($new){
$total_price += $export->isCanceled() ? $export->getPriceCanceledRaw() : $export->getPriceRaw();
$total_price_total += $export->getPriceTotalRaw();
$total_proceeds += $export->proceeds(true);
}
$total_amount_final += $service_provider_entry->getAmountFinalEurRaw();
$columns[] = array(
'BuchungsID' => $new ? $export->id : "",
'Status' => $new ? $export->lead->status->name : "",
'Storno' => $new ? $storno_date : "",
'MyJack Nr.' => $new ? $export->merlin_order_number : "",
'Organisation' => $new ? ($export->isCanceled() ? $export->price_canceled : $export->price) : "",
'Reisepreis' => $new ? $export->price_total : "",
'Erlös' => $new ? $export->proceeds() : "",
'Kunde' => $new ? $export->customer->fullName() : "",
'Reisedatum' => $new ? $export->getStartDateFormat() : "",
'bis' => $new ? $export->getEndDateFormat() : "",
'Buchungsdatum' => $new ? $export->getBookingDateFormat() : "",
'Reiseland' => $new && $export->travel_country ? $export->travel_country->name : "",
'Reiseprogramm' => $new && $export->travel_agenda ? $export->travel_agenda->name : "",
'Reiseteilnehmer' => $new ? $export->pax : "",
'Leistungsträger' => $service_provider_entry->service_provider->name,
'Zahlung' => $service_provider_entry->getAmountFinalEur(),
'Zahlungsdatum' => $service_provider_entry->getPaymentDateFormat(),
'Rechnungsnummer' => $service_provider_entry->invoice_number,
'abgeschlossen' => $service_provider_entry->is_cleared ? 'J' : 'N',
);
$new = false;
}
}else{
//$total_price += $export->booking->isCanceled() ? $export->booking->getPriceCanceledRaw() : $export->booking->getPriceRaw();
$total_price += $export->isCanceled() ? $export->getPriceCanceledRaw() : $export->getPriceRaw();
$columns[] = array(
'BuchungsID' => $export->id,
'Status' => $export->lead->status->name,
'Storno' => $storno_date,
'MyJack Nr.' => $export->merlin_order_number,
'Organisation' => $export->price,
'Organisation' => $export->isCanceled() ? $export->price_canceled : $export->price,
'Reisepreis' => $export->price_total,
'Erlös' => $export->proceeds(),
'Kunde' => $export->customer->fullName(),
'Reisedatum' => $export->getStartDateFormat(),
'bis' => $export->getEndDateFormat(),
'Buchungsdatum' => $export->getBookingDateFormat(),
'Reiseland' => $export->travel_country ? $export->travel_country->name : "",
'Reiseprogramm' => $export->travel_agenda ? $export->travel_agenda->name : "",
'Reiseteilnehmer' => $export->pax,
'Leistungsträger' => "",
'Zahlung' => "",
'Zahlungsdatum' => "",
'Rechnungsnummer' => "",
'abgeschlossen' => "",
);
}
}
$columns[] = array(
'BuchungsID' => "Total",
'Status' => "",
'Storno' => "",
'MyJack Nr.' => "",
'Organisation' => Util::_number_format($total_price),
'Reisepreis' => Util::_number_format($total_price_total),
'Erlös' => Util::_number_format($total_proceeds),
'Kunde' => "",
'Reisedatum' => "",
'bis' => "",
'Buchungsdatum' => "",
'Reiseland' => "",
'Reiseprogramm' => "",
'Reiseteilnehmer' => "",
'Leistungsträger' => "",
'Zahlung' => Util::_number_format($total_amount_final),
'Zahlungsdatum' => "",
'Rechnungsnummer' => "",
'abgeschlossen' => "",
);
}
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
}
public function checkBookingsDatatable()
{
$query = $this->prozessBookingSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (Booking $booking) {
return '<a data-order="' . $booking->id . '" href="' . route('booking_detail', [$booking->id]) . '" data-id="' . $booking->id . '">' . $booking->id . '</a>';
})
->addColumn('old_crm', function (Booking $booking) {
return '<a data-order="'.$booking->id.'" href="'.make_old_url('booking/'.$booking->id.'/edit').'" data-id="'.$booking->id.'">'.$booking->id.'</a>';
})
->addColumn('id', function (Booking $booking) {
return '<a data-order="' . $booking->id . '" href="' . route('booking_detail', [$booking->id]) . '" data-id="' . $booking->id . '">' . $booking->id . '</a>';
})
->addColumn('price', function (Booking $booking) {
return $booking->price;
})
->addColumn('service_total', function (Booking $booking) {
return $booking->getServiceTotal();
})
->addColumn('price_total', function (Booking $booking) {
return $booking->price_total;
})
->addColumn('check_total', function (Booking $booking) {
$check = $booking->getPriceRaw() + $booking->getServiceTotal(true);
return ($booking->getPriceTotalRaw() != $check) ? '<span class="badge badge-danger">'.Util::_number_format($check).'</span>' : "";
})
->addColumn('price_canceled', function (Booking $booking) {
return $booking->isCanceled() ? $booking->price_canceled : "";
})
->addColumn('start_date', function (Booking $booking) {
return $booking->getStartDateFormat();
})
->addColumn('end_date', function (Booking $booking) {
return $booking->getEndDateFormat();
})
->addColumn('booking_date', function (Booking $booking) {
return $booking->getBookingDateFormat();
})
->addColumn('lead.status_id', function (Booking $booking) {
if($booking->lead && $booking->lead->status_id){
$color = $booking->lead->status->color;
$icon = "";
if($booking->lead->status_id == 14 && $booking->lead->is_rebook){
$color = '#94ae59';
$icon = '<i class="fa fa-check-circle"></i> ';
}
if($booking->lead->status_id == 14 && !$booking->lead->is_rebook){
$icon = '<i class="fa fa-times-circle"></i> ';
}
return '<span data-order="'.$booking->lead->status_id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$booking->lead->status->name.'</span></span>';
}
return '<span data-order="0">-</span>';
})
->orderColumn('id', 'id $1')
->orderColumn('old_crm', 'old_crm $1')
->orderColumn('start_date', 'start_date $1')
->orderColumn('end_date', 'end_date $1')
->orderColumn('price', 'price $1')
->orderColumn('booking_date', 'booking_date $1')
->orderColumn('customer.firstname', 'customer.firstname $1')
->orderColumn('customer.name', 'customer.name $1')
//->orderColumn('lead.status_id', 'lead.status_id $1')
//->orderColumn('is_cleared', 'is_cleared $1')
->rawColumns(['id', 'old_crm', 'check_total', 'lead.status_id'])
->make(true);
}
}

View file

@ -0,0 +1,205 @@
<?php
namespace App\Http\Controllers\Admin;
use Request;
use Response;
use HTMLHelper;
use Carbon\Carbon;
use App\Models\Status;
use App\Services\Util;
use App\Models\Booking;
use App\Models\FewoLodging;
use App\Models\TravelAgenda;
use App\Models\TravelCompany;
use App\Models\ServiceProvider;
use Illuminate\Validation\Rules\In;
use App\Http\Controllers\Controller;
use App\Models\ServiceProviderEntry;
use Maatwebsite\Excel\Facades\Excel;
use App\Models\TravelUserBookingFewo;
use App\Exports\ReportCollectionExport;
class ReportFewoController extends Controller
{
public function __construct()
{
$this->middleware(['superadmin', '2fa']);
}
public function fewo()
{
$data = [
'filter_fewo_options' => FewoLodging::get()->pluck('name', 'id'),
];
return view('admin.report.fewo', $data);
}
//checkFewoDatatable
private function prozessFewoSearch()
{
$query = TravelUserBookingFewo::with('travel_booking_fewo_channel')->with('fewo_lodging')
->select('travel_user_booking_fewos.*')
->where('deleted_at', '=', null);
if(Request::get('filter_option_fewo_id') != ""){
$query->where('fewo_lodging_id', '=', Request::get('filter_option_fewo_id'));
}
if(Request::get('filter_date_from') != ""){
$date_from = Carbon::parse(Request::get('filter_date_from'))->format("Y-m-d");
$query->where("from_date", '>=', $date_from);
}
if(Request::get('filter_date_to') != ""){
$date_to = Carbon::parse(Request::get('filter_date_to'))->format("Y-m-d");
$query->where("to_date", '<=', $date_to);
}
if(Request::get('filter_booking_date_from') != ""){
$booking_date_from = Carbon::parse(Request::get('filter_booking_date_from'))->format("Y-m-d");
$query->where("booking_date", '>=', $booking_date_from);
}
if(Request::get('filter_booking_date_to') != ""){
$booking_date_to = Carbon::parse(Request::get('filter_booking_date_to'))->format("Y-m-d");
$query->where("booking_date", '<=', $booking_date_to);
}
return $query;
}
public function fewoDatatable()
{
$query = $this->prozessFewoSearch();
return \DataTables::eloquent($query)
->with('price_total_sum', function() use ($query) {
if($query->count() > 2000){
return 'max 2000 ';
}
$all = $query->get();
$proceeds = 0;
foreach ($all as $v){
$proceeds += $v->getPriceTotalRaw();
}
return Util::_number_format($proceeds);
})
->addColumn('id', function (TravelUserBookingFewo $travel_user_booking_fewo) {
return '<a data-order="'.$travel_user_booking_fewo->id.'" href="' . route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]) . '" class="">' . $travel_user_booking_fewo->id . '</a>';
// return '<a data-order="' . $travel_user_booking_fewo->id . '" href="' . route('booking_detail', [$travel_user_booking_fewo->id]) . '" data-id="' . $travel_user_booking_fewo->id . '">' . $travel_user_booking_fewo->id . '</a>';
})
->addColumn('travel_user', function (TravelUserBookingFewo $travel_user_booking_fewo) {
return '<a href="' . route('travel_user_detail', [$travel_user_booking_fewo->travel_user_id]) . '">'.$travel_user_booking_fewo->travel_user->first_name.' '.$travel_user_booking_fewo->travel_user->last_name.'</a>';
})
/* ->addColumn('start_date', function (TravelUserBookingFewo $travel_user_booking_fewo) {
return $travel_user_booking_fewo->getStartDateFormat();
})
->addColumn('end_date', function (TravelUserBookingFewo $travel_user_booking_fewo) {
return $travel_user_booking_fewo->getEndDateFormat();
})
/* ->addColumn('booking_date', function (TravelUserBookingFewo $travel_user_booking_fewo) {
return $travel_user_booking_fewo->getBookingDateFormat();
})
*/
->orderColumn('id', 'id $1')
->orderColumn('from_date', 'from_date $1')
->orderColumn('to_date', 'to_date $1')
->orderColumn('price_total', 'price_total $1')
->orderColumn('booking_date', 'booking_date $1')
->orderColumn('invoice_number', 'invoice_number $1')
//->orderColumn('lead.status_id', 'lead.status_id $1')
//->orderColumn('is_cleared', 'is_cleared $1')
->rawColumns(['id', 'travel_user'])
->make(true);
}
public function fewoExport(){
$query = $this->prozessFewoSearch();
$order = explode(",", Request::get('order'));
$orderByNum = [
0 => 'id',
1 => 'fewo_lodging.name',
2 => 'travel_user',
3 => 'from_date',
4 => 'to_date',
5 => 'adults',
6 => 'children',
7 => 'persons',
8 => 'price_total',
9 => 'booking_date',
10 => 'invoice_number',
];
if(isset($order[0])) {
$column = isset($orderByNum[$order[0]]) ? $orderByNum[$order[0]] : "id";
$direction = isset($order[1]) ? strtoupper($order[1]) : "ASC";
$query->orderBy($column, $direction);
}
$filename = "file-".date('Y-m-d-H-i-s');
$exports = $query->get();
$columns = [];
if(Request::get('export') === "export"){
$filename = "Buchungen_Fewo_".date('Y-m-d-H-i-s');
$headers = array(
'BuchungsID',
'FeWo',
'Kunde',
'vom',
'bis',
'Erwachsene',
'Kinder',
'Gesamt',
'Betrag',
'Buchungsdatum',
'R-Nr',
);
$total_price_total = 0;
foreach($exports as $export) {
$total_price_total += $export->getPriceTotalRaw();
$columns[] = array(
'BuchungsID' => $export->id,
'FeWo' => $export->fewo_lodging->name,
'Kunde' => $export->travel_user_id ? $export->travel_user->first_name.' '.$export->travel_user->last_name : " ",
'vom' => $export->from_date,
'bis' => $export->to_date,
'Erwachsene' => $export->adults,
'Kinder' => $export->children,
'Gesamt' => $export->persons,
'Betrag' => $export->price_total,
'Buchungsdatum' => $export->booking_date,
'R-Nr' => $export->invoice_number,
);
}
$columns[] = array(
'BuchungsID' => "Total",
'FeWo' => "",
'Kunde' => "",
'vom' => "",
'bis' => "",
'Erwachsene' => "",
'Kinder' => "",
'Gesamt' => Util::_number_format($total_price_total),
'Betrag' => "",
'Buchungsdatum' => "",
'R-Nr' => "",
);
}
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
}
}

View file

@ -0,0 +1,217 @@
<?php
namespace App\Http\Controllers\Admin;
use Request;
use Response;
use HTMLHelper;
use Carbon\Carbon;
use App\Models\Lead;
use App\Models\Status;
use App\Services\Util;
use App\Models\Booking;
use App\Models\LeadMail;
use App\Models\FewoLodging;
use App\Models\TravelAgenda;
use App\Models\TravelCompany;
use App\Models\ServiceProvider;
use Illuminate\Validation\Rules\In;
use App\Http\Controllers\Controller;
use App\Models\ServiceProviderEntry;
use Maatwebsite\Excel\Facades\Excel;
use App\Models\TravelUserBookingFewo;
use App\Exports\ReportCollectionExport;
class ReportLeadsController extends Controller
{
public function __construct()
{
$this->middleware(['superadmin', '2fa']);
}
public function leads()
{
// $query = Lead::with('customer')->with('sf_guard_user')->with('status')->select('lead.*');
$data = [
'filter_leads_options' => [], //need ??? FewoLodging::get()->pluck('name', 'id'),
];
return view('admin.report.leads', $data);
}
//checkLeadsDatatable
private function prozessLeadsSearch()
{
$query = Lead::with('customer')->with('sf_guard_user')->with('status')
->select('lead.*');
//->where('deleted_at', '=', null);
/*
if(Request::get('filter_option_leads_id') != ""){
$query->where('...?', '=', Request::get('filter_option_leads_id'));
}
*/
if(Request::get('filter_date_from') != ""){
$date_from = Carbon::parse(Request::get('filter_date_from'))->format("Y-m-d");
$query->where("request_date", '>=', $date_from);
}
if(Request::get('filter_date_to') != ""){
$date_to = Carbon::parse(Request::get('filter_date_to'))->format("Y-m-d");
$query->where("request_date", '<=', $date_to);
}
return $query;
}
public function leadsDatatable()
{
$query = $this->prozessLeadsSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (Lead $lead) {
return '<a data-order="'.$lead->id.'" href="'.route('lead_detail', [$lead->id]).'" data-id="'.$lead->id.'">'.$lead->id.'</a>';
})
->addColumn('customer_id', function (Lead $lead) {
return '<a data-order="'.$lead->customer_id.'" href="'.route('customer_detail', [$lead->customer_id]).'" data-id="'.$lead->customer_id.'">'.$lead->customer_id.'</a>';
})
->addColumn('request_date', function (Lead $lead) {
return Carbon::parse($lead->request_date)->format(\Util::formatDateDB());
})
->addColumn('travel_country', function (Lead $lead) {
return $lead->getTravelCountryDestco();
})
->addColumn('status', function (Lead $lead) {
return $lead->getStatusBadge();
})
->addColumn('lead_notice', function (Lead $lead) {
return $lead->lead_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-lead_id="'.$lead->id.'" data-action="get_popover_lead_notice" data-placement="top" data-toggle="popover" title="letzte Notiz"><i class="fa fa-check"></i></span>' :
'<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
})
->addColumn('last_lead_email', function (Lead $lead) {
if($lead->lead_mails->count()){
$lead_mail = $lead->lead_mails_sent_at->last();
$badge = $lead_mail->is_answer ? 'badge-default' : 'badge-secondary';
$badge = !$lead_mail->send ? $badge : 'badge-success';
return '<a data-order="'.$lead_mail->getSentAtRaw().'" href="#" data-toggle="modal"
data-target="#modals-load-content"
data-id="show-mail"
data-url="mail"
data-preview="true"
data-lead_id="'.$lead->id.'"
data-lead_mail_id="'.$lead_mail->id.'"
data-action="show-lead-mail"
data-redirect="back"
data-route="'.route('lead_mail_modal_load').'">
<span class="badge '.$badge.'">'
.($lead_mail->send ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-times-circle"></i>').' '
.$lead_mail->sent_at.'</span>
</a>';
}
return '<span data-order="">-</span>';
})
->addColumn('action_delete', function (Lead $lead) {
return '<a href="' . route('lead_delete', [$lead->id, 'lead']) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
})
->orderColumn('id', 'id $1')
->orderColumn('customer_id', 'customer_id $1')
->orderColumn('request_date', 'request_date $1')
->orderColumn('status', 'status_id $1')
->orderColumn('last_lead_email', function ($query, $order) {
$query->whereHas('lead_mails',
function ($q) use ($order) {
// $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //)
})->orderBy(
LeadMail::select('sent_at')
->whereColumn('lead_id', 'lead.id')
->orderBy('sent_at', 'DESC')
->limit(1)
, $order);
})
->filterColumn('id', function($query, $keyword) {
if($keyword != ""){
$query->where('id', 'LIKE', '%'.$keyword.'%');
}
})
->filterColumn('customer_id', function($query, $keyword) {
if($keyword != ""){
$query->where('customer_id', 'LIKE', '%'.$keyword.'%');
}
})
->rawColumns(['action_edit', 'customer_id', 'sf_guard_user_id', 'id', 'status', 'last_lead_email', 'travel_country', 'lead_notice', 'action_delete'])
->make(true);
}
public function leadsExport(){
$query = $this->prozessLeadsSearch();
$order = explode(",", Request::get('order'));
$orderByNum = [
0 => 'id',
1 => 'customer_id',
2 => 'customer.firstname',
3 => 'customer.name',
4 => 'customer.email',
5 => 'request_date',
6 => 'travel_country',
7 => 'sf_guard_user.last_name',
8 => 'status',
9 => 'last_lead_email',
];
if(isset($order[0])) {
$column = isset($orderByNum[$order[0]]) ? $orderByNum[$order[0]] : "id";
$direction = isset($order[1]) ? strtoupper($order[1]) : "ASC";
$query->orderBy($column, $direction);
}
$filename = "file-".date('Y-m-d-H-i-s');
$exports = $query->get();
$columns = [];
if(Request::get('export') === "export"){
$filename = "Buchungen_Anfragen_".date('Y-m-d-H-i-s');
$headers = array(
'LeadID',
'KundenID',
'Vorname',
'Nachname',
'E-Mail',
'Anfrage-Datum',
'Reiseland',
'Sachbearbeiter',
'Status',
'Letzte E-Mail',
);
foreach($exports as $export) {
$columns[] = array(
'LeadID' => $export->id,
'KundenID' => $export->customer_id,
'Vorname' => $export->customer ? $export->customer->firstname : " ",
'Nachname' => $export->customer ? $export->customer->name : " ",
'E-Mail' => $export->customer ? $export->customer->email : " ",
'Anfrage-Datum' => _format_date($export->request_date),
'Reiseland' => $export->getTravelCountryDestco(false),
'Sachbearbeiter' => $export->sf_guard_user->last_name,
'Status' => $export->status->name,
'Letzte E-Mail' => $export->lead_mails->count() ? $export->lead_mails_sent_at->last()->sent_at : " ",
);
}
}
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
}
}

View file

@ -0,0 +1,388 @@
<?php
namespace App\Http\Controllers\Admin;
use Request;
use Carbon\Carbon;
use App\Models\Status;
use App\Services\Util;
use App\Models\TravelCompany;
use App\Models\ServiceProvider;
use App\Http\Controllers\Controller;
use App\Models\ServiceProviderEntry;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\ReportCollectionExport;
class ReportProviderController extends Controller
{
public function __construct()
{
$this->middleware(['superadmin', '2fa']);
}
public function providers()
{
$data = [
'serviceProviders' => ServiceProvider::all(),
'filter_lead_status' => Status::get()->pluck('name', 'id')->toArray(),
'filter_travel_companies' => TravelCompany::where('active', true)->get()->pluck('name', 'id')->toArray(),
];
return view('admin.report.service_providers', $data);
}
private function prozessProvidersSearch(){
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer', 'booking.lead')->select('service_provider_entry.*')
->join('booking', 'service_provider_entry.booking_id', '=', 'booking.id' );
if(Request::get('filter_db_lead_status_id') != ""){
$query->whereHas('booking', function ($qe) {
$qe->whereHas('lead', function ($q) {
$q->whereIn('status_id', Request::get('filter_db_lead_status_id'));
});
});
}
if(Request::get('filter_lead_status_id') != ""){
$query->whereHas('booking', function ($qe) {
$qe->whereHas('lead', function ($q) {
$q->whereIn('status_id', Request::get('filter_lead_status_id'));
});
});
}
if(Request::get('filter_travel_company_id') != ""){
$query->whereHas('booking', function ($q) {
$q->whereIn("travel_company_id", Request::get('filter_travel_company_id'));
});
}
if(Request::get('filter_is_cleared') != ""){
$query->where('is_cleared', '=', Request::get('filter_is_cleared'));
}
if(Request::get('filter_service_provider_id') != ""){
$query->where('service_provider_id', '=', Request::get('filter_service_provider_id'));
}
if(Request::get('filter_travel_date_from') != ""){
$query->whereHas('booking', function ($q) {
$travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d");
$q->where("start_date", '>=', $travel_date_from);
});
}
if(Request::get('filter_travel_date_to') != ""){
$query->whereHas('booking', function ($q) {
$travel_date_to = Carbon::parse(Request::get('filter_travel_date_to'))->format("Y-m-d");
$q->where("start_date", '<=', $travel_date_to);
});
}
if(Request::get('filter_booking_date_from') != ""){
$query->whereHas('booking', function ($q) {
$filter_booking_date_from = Carbon::parse(Request::get('filter_booking_date_from'))->format("Y-m-d");
$q->where("booking_date", '>=', $filter_booking_date_from);
});
}
if(Request::get('filter_booking_date_to') != ""){
$query->whereHas('booking', function ($q) {
$filter_booking_date_to = Carbon::parse(Request::get('filter_booking_date_to'))->format("Y-m-d");
$q->where("booking_date", '<=', $filter_booking_date_to);
});
}
return $query;
}
public function providersDatatable()
{
$query = $this->prozessProvidersSearch();
return \DataTables::eloquent($query)
->with('price_total_sum', function() use ($query) {
if($query->count() > 200){
return 'max 200 ';
}
$all = $query->get();
$price = 0;
$isset = [];
foreach ($all as $v){
if(!in_array($v->booking->lead_id, $isset)){
$price += $v->booking->isCanceled() ? $v->booking->getPriceCanceledRaw() : $v->booking->getPriceRaw();
}
$isset[] = $v->booking->lead_id;
}
return Util::_number_format($price);
})
->with('price_total_total_sum', function() use ($query) {
if($query->count() > 200){
return 'max 200 ';
}
$all = $query->get();
$price = 0;
$isset = [];
foreach ($all as $v){
$price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceTotalRaw();
$isset[] = $v->booking->lead_id;
}
return Util::_number_format($price);
})
->with('proceed_total_sum', function() use ($query) {
if($query->count() > 200){
return 'max 200 ';
}
$all = $query->get();
$proceeds = 0;
$isset = [];
foreach ($all as $v){
$proceeds += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->proceeds(true);
$isset[] = $v->booking->lead_id;
}
return Util::_number_format($proceeds);
/*$all = $query->get();
$proceeds = 0;
foreach ($all as $v){
$proceeds += $v->proceeds(true);
}
return Util::_number_format($proceeds);*/
})
->addColumn('booking.id', function (ServiceProviderEntry $serviceProviderEntry) {
return '<a data-order="' . $serviceProviderEntry->booking->id . '" href="' . route('booking_detail', [$serviceProviderEntry->booking->id]) . '" data-id="' . $serviceProviderEntry->booking->id . '">' . $serviceProviderEntry->booking->id . '</a>';
})
->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->customer->fullName();
})
->addColumn('booking.price', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->booking_strono ? $serviceProviderEntry->booking->price_canceled : $serviceProviderEntry->booking->price;
})
->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->proceeds();
})
->addColumn('booking.start_date', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->getStartDateFormat();
})
->addColumn('booking.end_date', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->getEndDateFormat();
})
->addColumn('booking.booking_date', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->booking->getBookingDateFormat();
})
->addColumn('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) {
return $serviceProviderEntry->is_cleared ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
})
->addColumn('booking.lead.status_id', function (ServiceProviderEntry $serviceProviderEntry) {
if($serviceProviderEntry->booking->lead && $serviceProviderEntry->booking->lead->status_id){
$color = $serviceProviderEntry->booking->lead->status->color;
$icon = "";
if($serviceProviderEntry->booking->lead->status_id == 14 && $serviceProviderEntry->booking->lead->is_rebook){
$color = '#94ae59';
$icon = '<i class="fa fa-check-circle"></i> ';
}
if($serviceProviderEntry->booking->lead->status_id == 14 && !$serviceProviderEntry->booking->lead->is_rebook){
$icon = '<i class="fa fa-times-circle"></i> ';
}
return '<span data-order="'.$serviceProviderEntry->booking->lead->status_id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$serviceProviderEntry->booking->lead->status->name.'</span></span>';
}
return '<span data-order="0">-</span>';
})
->filterColumn('booking.customer.fullName', function ($query, $keyword) {
if ($keyword != "") {
$query->whereHas('booking', function ($q) use ($keyword) {
$q->whereHas('customer', function ($q) use ($keyword) {
$q->where("name", 'LIKE', '%' . $keyword . '%')
->orWhere('firstname', 'LIKE', '%' . $keyword . '%');
});
});
}
})
->orderColumn('booking.id', 'booking.id $1')
->orderColumn('booking.price', 'booking.price $1')
->orderColumn('booking.start_date', 'booking.start_date $1')
->orderColumn('booking.end_date', 'booking.end_date $1')
->orderColumn('booking.booking_date', 'booking.booking_date $1')
->orderColumn('booking.customer.firstname', 'booking.customer.firstname $1')
->orderColumn('booking.customer.name', 'booking.customer.name $1')
->orderColumn('is_cleared', 'is_cleared $1')
->rawColumns(['is_cleared', 'booking.id', 'booking.lead.status_id'])
->make(true);
}
public function providersExport()
{
$query = $this->prozessProvidersSearch();
$order = explode(",", Request::get('order'));
$orderByNum = [
0 => "id",
1 => "booking.id", //booking
4 => "booking.merlin_order_number",//booking
5 => "booking.price",//booking
6 => "booking.price_total",//booking
9 => "booking.start_date",//booking
10 => "booking.end_date",//booking
11 => "booking.booking_date",//booking
12 => "is_cleared",
];
if(isset($order[0])){
$column = isset($orderByNum[$order[0]]) ? $orderByNum[$order[0]] : "start_date";
$direction = isset($order[1]) ? strtoupper($order[1]) : "ASC";
$query->orderBy($column, $direction);;
}
$filename = "file-".date('Y-m-d-H-i-s');
$exports = $query->get();
$ctemps = [];
$columns = [];
if(Request::get('export') === "export"){
$filename = "Export_".date('Y-m-d-H-i-s');
$headers = array(
'Zähler',
'MyJack Nr.',
'CRM Nr',
'Kunde',
'Reisedatum',
'bis',
'Buchungsdatum',
'Organisation',
'Gesamtreisepreis',
'Reiseland',
'Reiseprogramm',
'Reiseteilnehmer',
'Leistungsträger',
'Rechnungsnummer',
'Zahlung',
'Zahlungsdatum',
'Erlös',
'Konto',
);
$isset = [];
$total_price = 0;
$total_price_total = 0;
$total_amount_final = 0;
$total_proceeds = 0;
foreach($exports as $export) {
$new = in_array($export->booking->id, $isset) ? false : true;
if($new){
$total_price += $export->booking->isCanceled() ? $export->booking->getPriceCanceledRaw() : $export->booking->getPriceRaw();
$total_price_total += $export->booking->getPriceTotalRaw();
$total_proceeds += $export->booking->proceeds(true);
}
$total_amount_final += $export->getAmountFinalEurRaw();
$ctemps[$export->booking->id][] = array(
'Zähler' => $new ? $export->getCounter() : "",
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
'CRM Nr' => $new ? $export->booking->lead_id : "",
'Kunde' => $new ? $export->booking->customer->name : "",
'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "",
'bis' => $new ? $export->booking->getEndDateFormat() : "",
'Buchungsdatum' => $export->booking->getBookingDateFormat(),
'Organisation' => $new ? ($export->booking->isCanceled() ? $export->booking->price_canceled : $export->booking->price) : "",
'Gesamtreisepreis' => $new ? $export->booking->price_total : "",
'Reiseland' => $new && $export->booking->travel_country ? $export->booking->travel_country->name : "",
'Reiseprogramm' => $new && $export->booking->travel_agenda ? $export->booking->travel_agenda->name : "",
'Reiseteilnehmer' => $new ? $export->booking->pax : "",
'Leistungsträger' => $export->service_provider->name,
'Rechnungsnummer' => $export->invoice_number,
'Zahlung' => $export->getAmountFinalEur(),
'Zahlungsdatum' => $export->getPaymentDateFormat(),
'Erlös' => $new ? $export->booking->proceeds() : "",
'Konto' => $export->booking->getKontoNumber()
);
$isset[] = $export->booking->id;
}
foreach($ctemps as $bid => $value){
$columns = array_merge($columns, $value);
}
$columns[] = array(
'Zähler' => "Total",
'MyJack Nr.' => "",
'CRM Nr' => "",
'Kunde' =>"",
'Reisedatum' => "",
'bis' => "",
'Buchungsdatum' => "",
'Organisation' => Util::_number_format($total_price),
'Gesamtreisepreis' => Util::_number_format($total_price_total),
'Reiseland' => "",
'Reiseprogramm' => "",
'Reiseteilnehmer' => "",
'Leistungsträger' => "",
'Rechnungsnummer' => "",
'Zahlung' => Util::_number_format($total_amount_final),
'Zahlungsdatum' => "",
'Erlös' => Util::_number_format($total_proceeds),
'Konto' => ""
);
}
if(Request::get('export') === "export_lt"){
$filename = "Export_LT_".date('Y-m-d-H-i-s');
$headers = array(
'Zähler',
'MyJack Nr.',
'CRM Nr',
'Kunde',
'Reisedatum',
'bis',
'Buchungsdatum',
'Reiseland',
'Reiseprogramm',
'Reiseteilnehmer',
'Leistungsträger',
'Rechnungsnummer',
'Zahlung',
'ZahlungVorgang',
);
$isset = [];
$total_amount_final = 0;
$payments_total = 0;
foreach($exports as $export) {
$new = in_array($export->booking->id, $isset) ? false : true;
if($new) {
$payments_total += $export->booking->getServiceProviderPaymentsTotal(true);
}
$total_amount_final += $export->getAmountFinalEurRaw();
$ctemps[$export->booking->id][] = array(
'Zähler' => $new ? $export->getCounter() : "",
'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "",
'CRM Nr' => $new ? $export->booking->lead_id : "",
'Kunde' => $new ? $export->booking->customer->name : "",
'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "",
'bis' => $new ? $export->booking->getEndDateFormat() : "",
'Buchungsdatum' => $new ? $export->booking->getBookingDateFormat() : "",
'Reiseland' => $new && $export->booking->travel_country ? $export->booking->travel_country->name : "",
'Reiseprogramm' => $new && $export->booking->travel_agenda ? $export->booking->travel_agenda->name : "",
'Reiseteilnehmer' => $new ? $export->booking->pax : "",
'Leistungsträger' => $export->service_provider->name,
'Rechnungsnummer' => $export->invoice_number,
'Zahlung' => $export->getAmountFinalEur(),
'ZahlungVorgang' => $export->booking->getServiceProviderPaymentsTotal(),
);
$isset[] = $export->booking->id;
}
foreach($ctemps as $bid => $value){
$columns = array_merge($columns, $value);
}
$columns[] = array(
'Zähler' => "Total",
'MyJack Nr.' => "",
'CRM Nr' => "",
'Kunde' => "",
'Reisedatum' => "",
'bis',
'Buchungsdatum' => "",
'Reiseland' => "",
'Reiseprogramm' => "",
'Reiseteilnehmer' => "",
'Leistungsträger' => "",
'Rechnungsnummer' => "",
'Zahlung' => Util::_number_format($total_amount_final),
'ZahlungVorgang' => Util::_number_format($payments_total),
);
}
return Excel::download(new ReportCollectionExport($columns, $headers), $filename.'.xls');
}
}

View file

@ -9,7 +9,7 @@ use App\User;
use Validator; use Validator;
use DataTables; use DataTables;
use App\Models\Account; use App\Models\Account;
use App\Services\HTMLHelper; use App\Helper\HTMLHelper;
use App\Services\MyGoogle2FA; use App\Services\MyGoogle2FA;
use App\Mail\MailVerifyContact; use App\Mail\MailVerifyContact;
use App\Repositories\UserRepository; use App\Repositories\UserRepository;

View file

@ -46,6 +46,7 @@ class LoginController extends Controller
$user->last_login = date('Y-m-d H:i:s'); $user->last_login = date('Y-m-d H:i:s');
$user->save(); $user->save();
} }
protected function handleUserWasAuthenticated(Request $request, $throttles) protected function handleUserWasAuthenticated(Request $request, $throttles)
{ {

View file

@ -5,27 +5,33 @@ namespace App\Http\Controllers;
use Request; use Request;
use App\Models\Booking; use App\Models\Booking;
use App\Models\BookingFile; use App\Models\BookingFile;
use App\Models\Participant;
use App\Models\BookingNotice; use App\Models\BookingNotice;
use App\Models\TravelCompany;
use App\Models\ServiceProvider; use App\Models\ServiceProvider;
use App\Models\BookingDraftItem; use App\Models\BookingDraftItem;
use App\Models\BookingServiceItem; use App\Models\BookingServiceItem;
use App\Models\Participant;
use App\Models\ServiceProviderEntry; use App\Models\ServiceProviderEntry;
use App\Models\TravelCompany;
use App\Repositories\DraftRepository; use App\Repositories\DraftRepository;
use App\Repositories\BookingRepository; use App\Repositories\BookingRepository;
use App\Repositories\CustomerRepository;
use App\Repositories\BookingPDFRepository;
use App\Repositories\BookingFileRepository; use App\Repositories\BookingFileRepository;
use App\Repositories\CustomerFileRepository;
use App\Repositories\CustomerMailRepository; use App\Repositories\CustomerMailRepository;
class BookingController extends Controller class BookingController extends Controller
{ {
protected $bookingRepo; protected $bookingRepo;
protected $custRepo;
public function __construct(BookingRepository $bookingRepo) public function __construct(BookingRepository $bookingRepo, CustomerRepository $custRepo)
{ {
$this->middleware(['admin', '2fa']); $this->middleware(['admin', '2fa']);
$this->bookingRepo = $bookingRepo; $this->bookingRepo = $bookingRepo;
$this->custRepo = $custRepo;
} }
public function index($step = false) public function index($step = false)
@ -63,6 +69,29 @@ class BookingController extends Controller
$data = Request::all(); $data = Request::all();
if($id === "new") {
$booking = new Booking();
}else{
$booking = Booking::findOrFail($id);
}
if($data['action'] === 'deleteAllChecked'){
if(!isset($data['draft_item_delete']) || !$data['draft_item_delete']){
\Session()->flash('alert-error', 'Es wurden keine Leistungen ausgewählt');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
}
foreach ($data['draft_item_delete'] as $draft_item_delete_id => $v) {
$booking_draft_item = BookingDraftItem::findOrFail($draft_item_delete_id);
if($booking_draft_item->booking_id === $booking->id){
$booking_draft_item->delete();
}
}
$booking->calculate_price_total();
return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
}
if($data['action'] === 'save_notice'){ if($data['action'] === 'save_notice'){
$booking = $this->bookingRepo->updateNotice($id, $data); $booking = $this->bookingRepo->updateNotice($id, $data);
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
@ -73,65 +102,16 @@ class BookingController extends Controller
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice"); return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
} }
if(strpos($data['action'], 'createPDF') !== false) {
if($data['action'] === 'save_lead_status'){ $bookingPDF = new BookingPDFRepository($booking);
$booking = $this->bookingRepo->updateLeadStatus($id, $data); $bookingPDF->createPDF($id, $data);
\Session()->flash('alert-save', '1'); \Session()->flash('alert-success', 'PDF Datei erstellt');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingLead"); return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles");
}
if($data['action'] === 'update_booking'){
$booking = $this->bookingRepo->updateBooking($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingBooking");
} }
if($data['action'] === 'update_booking_services'){ $redirect = route('booking_detail', [$booking->id]);
$booking = $this->bookingRepo->updateBookingServices($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingServices");
}
if($data['action'] === 'update_booking_number'){
$booking = $this->bookingRepo->updateBookingNumber($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingMyJack");
}
if($data['action'] === 'update_booking_price'){
$booking = $this->bookingRepo->updateBookingPrice($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingPrice");
}
if($data['action'] === 'update_service_provider_entry'){
$booking = $this->bookingRepo->updateServiceProviderEntry($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
}
if($data['action'] === 'update_booking_service_item'){
$booking = $this->bookingRepo->updateBookingServiceItem($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
}
if($data['action'] === 'update_booking_participant'){
$booking = $this->bookingRepo->updateBookingParticipant($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingParticipant");
}
if($id === "new") {
$booking = new Booking();
}else{
$booking = Booking::findOrFail($id);
}
// $booking->merlin_order_number = $data['merlin_order_number'];
// $booking->save();
$i = 1;
$i= 1;
if($data['action'] === 'addItemUp'){ if($data['action'] === 'addItemUp'){
$travel_program_id = null; $travel_program_id = null;
$request_date = null; $request_date = null;
@ -142,49 +122,50 @@ class BookingController extends Controller
$request_date = $first_booking_draft_item->request_date; $request_date = $first_booking_draft_item->request_date;
$comfort = $first_booking_draft_item->comfort; $comfort = $first_booking_draft_item->comfort;
} }
$booking->booking_draft_items()->create([ $add_draft_items_up_number = isset($data['add_draft_items_up_number']) ? intval($data['add_draft_items_up_number']) : 1;
'booking_id' => $booking->id, for ($j=0; $j < $add_draft_items_up_number; $j++) {
'travel_program_id' => $travel_program_id, $booking->booking_draft_items()->create([
'fewo_lodging_id' => null, 'booking_id' => $booking->id,
'travel_class_id' => null, 'travel_program_id' => $travel_program_id,
'draft_item_id' => null, 'fewo_lodging_id' => null,
'draft_type_id' => null, 'travel_class_id' => null,
'request_date' => $request_date, 'draft_item_id' => null,
'days_start' => null, 'draft_type_id' => null,
'days_duration' => null, 'request_date' => $request_date,
'start_date' => null, 'days_start' => null,
'end_date' => null, 'days_duration' => null,
'service' => '', 'start_date' => null,
'price_adult' => null, 'end_date' => null,
'adult' => null , 'service' => '',
'price_children' => 0, 'price_adult' => null,
'children' => 0, 'adult' => null ,
'price' => 0, 'price_children' => 0,
'pos' => $i, 'children' => 0,
'in_pdf' => true, 'price' => 0,
'comfort' => $comfort 'pos' => $i,
]); 'in_pdf' => true,
$i++; 'comfort' => $comfort
]);
$i++;
}
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
} }
if(isset($data['draft_item'])){ if(isset($data['draft_item'])){
foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item){ foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item){
$BookingDraftItem = BookingDraftItem::findOrFail($booking_draft_item_id); $BookingDraftItem = BookingDraftItem::findOrFail($booking_draft_item_id);
$draft_item['price_adult'] = isset($draft_item['price_adult']) ? $draft_item['price_adult'] : null; $draft_item['price_adult'] = isset($draft_item['price_adult']) ? $draft_item['price_adult'] : null;
$draft_item['adult'] = isset($draft_item['adult']) ? $draft_item['adult'] : null; $draft_item['adult'] = isset($draft_item['adult']) ? $draft_item['adult'] : null;
$draft_item['price_children'] = isset($draft_item['price_children']) ? $draft_item['price_children'] : null; $draft_item['price_children'] = isset($draft_item['price_children']) ? $draft_item['price_children'] : null;
$draft_item['children'] = isset($draft_item['children']) ? $draft_item['children'] : null; $draft_item['children'] = isset($draft_item['children']) ? $draft_item['children'] : null;
$draft_item['price'] = isset($draft_item['price']) ? $draft_item['price'] : null; $draft_item['price'] = isset($draft_item['price']) ? $draft_item['price'] : null;
$draft_item['pos'] = $i++; $draft_item['pos'] = $i++;
$draft_item['in_pdf'] = isset($draft_item['in_pdf']) ? true : false; $draft_item['in_pdf'] = isset($draft_item['in_pdf']) ? true : false;
$BookingDraftItem->fill($draft_item); $BookingDraftItem->fill($draft_item);
$BookingDraftItem->save(); $BookingDraftItem->save();
} }
} }
if($data['action'] === 'addItemDown'){ if($data['action'] === 'addItemDown'){
$travel_program_id = null; $travel_program_id = null;
$request_date = null; $request_date = null;
@ -195,30 +176,88 @@ class BookingController extends Controller
$request_date = $first_booking_draft_item->request_date; $request_date = $first_booking_draft_item->request_date;
$comfort = $first_booking_draft_item->comfort; $comfort = $first_booking_draft_item->comfort;
} }
$booking->booking_draft_items()->create([ $add_draft_items_up_number = isset($data['add_draft_items_down_number']) ? intval($data['add_draft_items_down_number']) : 1;
'booking_id' => $booking->id, for ($j=0; $j < $add_draft_items_up_number; $j++) {
'travel_program_id' => $travel_program_id, $booking->booking_draft_items()->create([
'fewo_lodging_id' => null, 'booking_id' => $booking->id,
'travel_class_id' => null, 'travel_program_id' => $travel_program_id,
'draft_item_id' => null, 'fewo_lodging_id' => null,
'draft_type_id' => null, 'travel_class_id' => null,
'request_date' => $request_date, 'draft_item_id' => null,
'days_start' => null, 'draft_type_id' => null,
'days_duration' => null, 'request_date' => $request_date,
'start_date' => null, 'days_start' => null,
'end_date' => null, 'days_duration' => null,
'service' => '', 'start_date' => null,
'price_adult' => null, 'end_date' => null,
'adult' => null , 'service' => '',
'price_children' => 0, 'price_adult' => null,
'children' => 0, 'adult' => null ,
'price' => 0, 'price_children' => 0,
'pos' => $i, 'children' => 0,
'in_pdf' => true, 'price' => 0,
'comfort' => $comfort 'pos' => $i,
]); 'in_pdf' => true,
'comfort' => $comfort
]);
$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' ||
$data['action'] === 'update_booking_services' || $data['action'] === 'update_booking_number' || $data['action'] === 'update_booking_price' ||
$data['action'] === 'update_service_provider_entry' || $data['action'] === 'update_booking_service_item' || $data['action'] === 'update_booking_participant'){
$customer = $this->custRepo->updateCustomerFromBooking($id, $data);
$booking = $this->bookingRepo->updateLeadStatus($id, $data);
$booking = $this->bookingRepo->updateBooking($id, $data);
$booking = $this->bookingRepo->updateBookingServices($id, $data);
$booking = $this->bookingRepo->updateBookingNumber($id, $data);
$booking = $this->bookingRepo->updateBookingPrice($id, $data);
$booking = $this->bookingRepo->updateServiceProviderEntry($id, $data);
$booking = $this->bookingRepo->updateBookingServiceItem($id, $data);
$booking = $this->bookingRepo->updateBookingParticipant($id, $data);
\Session()->flash('alert-save', '1');
switch($data['action']){
case 'saveCustomer':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingCustomer");
break;
case 'saveAll':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
break;
case 'update_booking':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingBooking");
break;
case 'save_lead_status':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingLead");
break;
case 'update_booking_services':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingServices");
break;
case 'update_booking_number':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingMyJack");
break;
case 'update_booking_price':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingPrice");
break;
case 'update_service_provider_entry':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingProvider");
break;
case 'update_booking_service_item':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingCompany");
break;
case 'update_booking_participant':
$redirect = redirect(route('booking_detail', [$booking->id])."#collapseBookingParticipant");
break;
}
}
$booking->calculate_price_total(); $booking->calculate_price_total();
if(strpos($data['action'], 'up_') !== false) { if(strpos($data['action'], 'up_') !== false) {
@ -246,7 +285,7 @@ class BookingController extends Controller
} }
} }
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])); return $redirect;
} }
public function loadModal(){ public function loadModal(){
@ -275,6 +314,41 @@ class BookingController extends Controller
$ret = view("booking.edit_notice_modal", compact('data', 'value'))->render(); $ret = view("booking.edit_notice_modal", compact('data', 'value'))->render();
} }
if($data['action'] === "createPDF_Coupon") {
$booking = Booking::findOrFail($data['booking_id']);
$data['has_coupon'] = $booking->hasDocument('coupon');
$data['default_value'] = config('booking.coupon_default_value');
$data['issue_date'] = date('d.m.Y');
$data['valid_date'] = \Carbon::now()->addMonths(config('booking.coupon_valid_date_month'))->format('d.m.Y');
$ret = view("booking.modal_create_coupon", compact('data'))->render();
}
if($data['action'] === "createPDF_Storno") {
$booking = Booking::findOrFail($data['booking_id']);
$data['price'] = $booking->price;
if($data['has_storno'] = $booking->hasDocument('storno')){
$document_storno = $booking->getDocument('storno');
$data['storno_date'] = \Carbon::parse($document_storno->data->storno_date)->format('d.m.Y');
$data['storno_print'] = \Carbon::parse($document_storno->data->storno_print)->format('d.m.Y') ;
$data['storno_status_id'] = $document_storno->data->storno_status_id;
$data['storno_level'] = $document_storno->data->storno_level;
$data['storno_level_number'] = _number_format($document_storno->data->storno_level);
$data['storno_total_price'] = '';
}else{
$data['storno_date'] = date('d.m.Y');
$data['storno_print'] = date('d.m.Y');
$data['storno_status_id'] = null;
$data['storno_level'] = 100;
$data['storno_level_number'] = '';
$data['storno_total_price'] = '';
}
$ret = view("booking.modal_create_storno", compact('data'))->render();
}
if($data['action'] === "upload-booking-file"){ if($data['action'] === "upload-booking-file"){
if($data['booking_id']){ if($data['booking_id']){
$bookingFileRepo = new BookingFileRepository(new BookingFile()); $bookingFileRepo = new BookingFileRepository(new BookingFile());
@ -288,15 +362,14 @@ class BookingController extends Controller
} }
return response()->json(['response' => $data, 'html'=>$ret]); return response()->json(['response' => $data, 'html'=>$ret]);
} }
public function draftItemDelete($id){ public function draftItemDelete($id){
$boking_draft_item = BookingDraftItem::findOrFail($id); $booking_draft_item = BookingDraftItem::findOrFail($id);
$booking = $boking_draft_item->booking; $booking = $booking_draft_item->booking;
$boking_draft_item->delete(); $booking_draft_item->delete();
$booking->calculate_price_total(); $booking->calculate_price_total();
\Session()->flash('alert-success', __('Eintrag gelöscht')); \Session()->flash('alert-success', __('Eintrag gelöscht'));
return redirect(route('booking_detail', [$booking->id])); return redirect(route('booking_detail', [$booking->id])."#collapseBookingOrganisation");
} }
public function action($action, $id=false){ public function action($action, $id=false){
@ -361,18 +434,10 @@ class BookingController extends Controller
public function delete($id, $del="booking"){ public function delete($id, $del="booking"){
if($del === 'booking') {
//$model = Booking::findOrFail($id);
//$model->delete();
\Session()->flash('alert-success', __('Löschen noch nicht programmiert'));
}
if($del === 'booking_file'){ if($del === 'booking_file'){
$booking_file = BookingFile::findOrFail($id); $booking_file = BookingFile::findOrFail($id);
$booking = $booking_file->booking; $booking = $booking_file->booking;
$fileRepo = new BookingFileRepository($booking_file); $this->deleteBookingFile($booking_file);
$fileRepo->_set('disk', 'booking');
$fileRepo->delete();
$booking_file->delete();
\Session()->flash('alert-success', 'Datei gelöscht'); \Session()->flash('alert-success', 'Datei gelöscht');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles"); return redirect(route('booking_detail', [$booking->id])."#collapseBookingFiles");
} }
@ -422,6 +487,98 @@ class BookingController extends Controller
} }
private function deleteBookingFile($booking_file){
$fileRepo = new BookingFileRepository($booking_file);
$fileRepo->_set('disk', 'booking');
$fileRepo->delete();
$booking_file->delete();
}
private function deleteCustomerFile($customer_file){
$fileRepo = new CustomerFileRepository($customer_file);
$fileRepo->_set('disk', 'customer');
$fileRepo->delete();
$customer_file->delete();
}
private function deleteBookingDocument($booking_document){
$booking_document->deleteFile();
$booking_document->delete();
}
public function deleteComplete($id){
$booking = Booking::findOrFail($id);
if($booking->booking_files){
foreach ($booking->booking_files as $booking_file) {
$this->deleteBookingFile($booking_file);
}
}
if($booking->booking_notices){
foreach ($booking->booking_notices as $booking_notice) {
$booking_notice->delete();
}
}
if($booking->service_provider_entries){
foreach ($booking->service_provider_entries as $service_provider_entry) {
$service_provider_entry->delete();
}
}
if($booking->booking_service_items){
foreach ($booking->booking_service_items as $booking_service_item) {
$booking_service_item->delete();
}
}
if($booking->booking_provider_services){
foreach ($booking->booking_provider_services as $booking_provider_service) {
$booking_provider_service->delete();
}
}
if($booking->booking_country_services){
foreach ($booking->booking_country_services as $booking_country_service) {
$booking_country_service->delete();
}
}
if($booking->participants){
foreach ($booking->participants as $participant) {
$participant->delete();
}
}
if($booking->customer_mails){
foreach ($booking->customer_mails_reverse as $customer_mail) {
if($customer_mail->customer_files){
foreach ($customer_mail->customer_files as $customer_file) {
$this->deleteCustomerFile($customer_file);
}
}
$customer_mail->delete();
}
}
if($booking->booking_documents){
foreach ($booking->booking_documents as $booking_document) {
if($booking_document->identifier === 'coupon'){
//coupon set booking ID to null <- is need by the customer
$booking_document->booking_id = null;
$booking_document->save();
}else{
$this->deleteBookingDocument($booking_document);
}
}
}
if($booking->coupons){
foreach ($booking->coupons as $coupon) {
//coupon set booking ID to null <- is need by the customer
$coupon->booking_id = null;
$coupon->save();
}
}
$booking->delete();
\Session()->flash('alert-success', 'Buchung gelöscht');
return redirect(route('requests'));
}
} }

View file

@ -5,9 +5,6 @@ namespace App\Http\Controllers\CMS;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\CMSContent; use App\Models\CMSContent;
use App\Models\FewoLodging;
use App\Services\BookingFewo;
use App\Services\CreatePDF;
use App\Services\Util; use App\Services\Util;
use Request; use Request;
@ -256,16 +253,6 @@ class CMSBookingController extends Controller
return redirect(route('cms_booking_content_detail', [$id])); return redirect(route('cms_booking_content_detail', [$id]));
} }
/* if($data['action'] === 'previewPDF'){
$pdf_content = BookingFewo::getFeWoCMSContentForPDF($this->identifier_content, $identifier_fewo);
$pdf_file = new CreatePDF('pdf.fewo_instructions');
return $pdf_file->create([
'contents' => $pdf_content,
'fewo' => $fewo
]
);
}
*/
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
return redirect(route('cms_booking_content')); return redirect(route('cms_booking_content'));
} }

View file

@ -8,7 +8,7 @@ use App\Models\CMSContent;
use App\Models\CMSInfo; use App\Models\CMSInfo;
use App\Models\CMSInfoAvailable; use App\Models\CMSInfoAvailable;
use App\Models\CMSInfoHoliday; use App\Models\CMSInfoHoliday;
use App\Services\HTMLHelper; use App\Helper\HTMLHelper;
use Request; use Request;
use Validator; use Validator;

View file

@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
use App\Models\CMSContent; use App\Models\CMSContent;
use App\Models\FewoLodging; use App\Models\FewoLodging;
use App\Services\BookingFewo; use App\Services\BookingFewo;
use App\Services\CreatePDF; use App\Libraries\CreatePDF;
use App\Services\Util; use App\Services\Util;
use Request; use Request;

View file

@ -6,6 +6,7 @@ namespace App\Http\Controllers\CMS;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Feedback; use App\Models\Feedback;
use Carbon\Carbon; use Carbon\Carbon;
use IqContent\LaravelFilemanager\Lfm;
use Request; use Request;
class CMSFeedbackController extends Controller class CMSFeedbackController extends Controller
@ -38,6 +39,8 @@ class CMSFeedbackController extends Controller
$feedback = new Feedback(); $feedback = new Feedback();
$id = 'new'; $id = 'new';
$feedback->status = 1; $feedback->status = 1;
$feedback->content_new = "";
}else{ }else{
$feedback = Feedback::findOrFail($id); $feedback = Feedback::findOrFail($id);
@ -46,6 +49,7 @@ class CMSFeedbackController extends Controller
$data = [ $data = [
'feedback' => $feedback, 'feedback' => $feedback,
'id' => $id, 'id' => $id,
'lfm_helper' => app(Lfm::class),
]; ];
return view('cms.feedback.detail', $data); return view('cms.feedback.detail', $data);
@ -67,15 +71,18 @@ class CMSFeedbackController extends Controller
$feedback->show_in_navi = 1; $feedback->show_in_navi = 1;
$feedback->catalog_id = 1; $feedback->catalog_id = 1;
}else{ }else{
$feedback = Feedback::findOrFail($id); $feedback = Feedback::findOrFail($id);
} }
$feedback->title = $data['title']; $feedback->title = $data['title'];
$feedback->status = isset($data['status']) ? true : false; $feedback->status = isset($data['status']) ? true : false;
$feedback->slug = $data['slug']; $feedback->slug = $data['slug'];
$feedback->date = $data['date']; $feedback->date = $data['date'];
$feedback->content = $data['content']; $feedback->content_new = $data['content_new'];
$feedback->box_body = $data['image'];
$feedback->description = $data['description']; $feedback->description = $data['description'];
$feedback->pagetitle = $data['pagetitle']; $feedback->pagetitle = $data['pagetitle'];
$feedback->keywords = $data['keywords']; $feedback->keywords = $data['keywords'];
@ -93,6 +100,9 @@ class CMSFeedbackController extends Controller
if($first_feedback = $parent_feedback->children->first()){ if($first_feedback = $parent_feedback->children->first()){
$feedback->lft = $first_feedback->lft; $feedback->lft = $first_feedback->lft;
$feedback->rgt = $first_feedback->rgt; $feedback->rgt = $first_feedback->rgt;
}else{
$feedback->lft = $parent_feedback->lft +1;
$feedback->rgt = $parent_feedback->lft +2;
} }
$feedback->tree_root = $parent_feedback->tree_root; $feedback->tree_root = $parent_feedback->tree_root;

View file

@ -54,6 +54,15 @@ class CMSTravelGuideController extends Controller
} }
public function test()
{
//make tree
$data = [
];
return view('cms.travel_guide.test', $data);
}
public function detail($id) public function detail($id)
{ {
if($id === "new") { if($id === "new") {

View file

@ -47,10 +47,14 @@ class CustomerController extends Controller
public function store($id) public function store($id)
{ {
$data = Request::all(); $data = Request::all();
if(!isset($data['action'])){
abort(403, 'keine Action');
}
//save
$customer = $this->custRepo->updateCustomer($id, $data);
\Session()->flash('alert-save', '1');
if($data['action'] === 'saveCustomer'){ if($data['action'] === 'saveCustomer'){
$customer = $this->custRepo->updateCustomer($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('customer_detail', [$id]).'#collapseCustomerDetail'); return redirect(route('customer_detail', [$id]).'#collapseCustomerDetail');
} }
return back(); return back();

View file

@ -70,7 +70,7 @@ class CustomerFewoMailController extends Controller
$customer_mail->save(); $customer_mail->save();
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function delete($id){ public function delete($id){
@ -128,14 +128,14 @@ class CustomerFewoMailController extends Controller
}else{ }else{
\Session()->flash('alert-success', "Mail gesendet!"); \Session()->flash('alert-success', "Mail gesendet!");
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function replyMail(CustomerFewoMailRepository $customerFewoMailRepository){ public function replyMail(CustomerFewoMailRepository $customerFewoMailRepository){
$data = Request::all(); $data = Request::all();
$customerFewoMailRepository->replyStore($data); $customerFewoMailRepository->replyStore($data);
\Session()->flash('alert-success', "Mail gespeichert!"); \Session()->flash('alert-success', "Mail gespeichert!");
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function getEmailTemplates() public function getEmailTemplates()

View file

@ -9,12 +9,12 @@ use Response;
use App\Models\Coupon; use App\Models\Coupon;
use App\Services\Util; use App\Services\Util;
use App\Models\FewoLodging; use App\Models\FewoLodging;
use App\Services\CreatePDF; use App\Libraries\CreatePDF;
use App\Models\BookingStorno; use App\Models\BookingStorno;
use App\Services\BookingFewo; use App\Services\BookingFewo;
use App\Models\BookingVoucher; use App\Models\BookingVoucher;
use App\Models\TravelInsurance; use App\Models\TravelInsurance;
use App\Services\CreateCouponPDF; use App\Libraries\CreateCouponPDF;
use App\Models\BookingApplication; use App\Models\BookingApplication;
use App\Models\BookingConfirmation; use App\Models\BookingConfirmation;
use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\URL;
@ -46,20 +46,21 @@ class CustomerFileController extends Controller
$content_disposition = $cd ? 'attachment' : 'inline'; $content_disposition = $cd ? 'attachment' : 'inline';
$file = false; $file = false;
$filename = ""; $filename = "";
switch ($model){ switch ($model){
case 'booking_application': case 'registration':
if($booking_application = BookingApplication::find($id)){ if($booking_application = BookingApplication::find($id)){
$filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf"; $filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf";
$file = base64_decode($booking_application->binary_data); $file = base64_decode($booking_application->binary_data);
} }
break; break;
case 'booking_confirmation': case 'confirmation':
if($booking_confirmation = BookingConfirmation::find($id)){ if($booking_confirmation = BookingConfirmation::find($id)){
$filename = "Reisebestaetigung-".$booking_confirmation->booking->getBookingNumber().".pdf"; $filename = "Reisebestaetigung-".$booking_confirmation->booking->getBookingNumber().".pdf";
$file = base64_decode($booking_confirmation->binary_data); $file = base64_decode($booking_confirmation->binary_data);
} }
break; break;
case 'booking_storno': case 'storno':
if($booking_stornos = BookingStorno::find($id)){ if($booking_stornos = BookingStorno::find($id)){
$filename = "Reisestornierung-".$booking_stornos->booking->getBookingNumber().".pdf"; $filename = "Reisestornierung-".$booking_stornos->booking->getBookingNumber().".pdf";
$file = base64_decode($booking_stornos->binary_data); $file = base64_decode($booking_stornos->binary_data);
@ -68,21 +69,20 @@ class CustomerFileController extends Controller
case 'coupon': case 'coupon':
if($coupon = Coupon::find($id)){ if($coupon = Coupon::find($id)){
$filename = "Gutschein-".$coupon->number.".pdf"; $filename = "Gutschein-".$coupon->number.".pdf";
$pdf = new CreateCouponPDF($coupon); $pdf = new CreateCouponPDF($coupon);
$pdf->create(); $pdf->create();
return $pdf->output($filename, $cd); return $pdf->output($filename, $cd);
} }
break; break;
case 'booking_voucher': case 'voucher':
if($booking_voucher = BookingVoucher::find($id)){ if($booking_voucher = BookingVoucher::find($id)){
$filename = "Voucher-".$booking_voucher->booking->getBookingNumber().".pdf"; $filename = "Voucher-".$booking_voucher->booking->getBookingNumber().".pdf";
$file = base64_decode($booking_voucher->binary_data); $file = base64_decode($booking_voucher->binary_data);
} }
break; break;
case 'booking_voucher_agency': case 'voucher_agency':
if($booking_voucher_agency = BookingVoucherAgency::find($id)){ if($booking_voucher_agency = BookingVoucherAgency::find($id)){
$filename = "Voucher-Agentur-".$booking_voucher_agency->booking->getBookingNumber().".pdf"; $filename = "Voucher-Agentur-".$booking_voucher_agency->booking->getBookingNumber().".pdf";
$file = base64_decode($booking_voucher_agency->binary_data); $file = base64_decode($booking_voucher_agency->binary_data);

View file

@ -91,7 +91,7 @@ class CustomerMailController extends Controller
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function delete($id){ public function delete($id){
@ -148,14 +148,14 @@ class CustomerMailController extends Controller
}else{ }else{
\Session()->flash('alert-success', "Mail gesendet!"); \Session()->flash('alert-success', "Mail gesendet!");
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function replyMail(CustomerMailRepository $customerMailRepository){ public function replyMail(CustomerMailRepository $customerMailRepository){
$data = Request::all(); $data = Request::all();
$customerMailRepository->replyStore($data); $customerMailRepository->replyStore($data);
\Session()->flash('alert-success', "Mail gespeichert!"); \Session()->flash('alert-success', "Mail gespeichert!");
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function getEmailTemplates() public function getEmailTemplates()

View file

@ -3,7 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Booking; use App\Models\Booking;
use App\Services\HTMLHelper; use App\Helper\HTMLHelper;
use Carbon\Carbon; use Carbon\Carbon;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use DataTables; use DataTables;

View file

@ -22,53 +22,64 @@ class FileController extends Controller
{ {
$path = ""; $path = "";
$filename = ""; $filename = "";
if ($disk === 'customer'){
$file = \App\Models\CustomerFile::findOrFail($id); switch ($disk){
$filename = $file->original_name; case 'customer':
$path = $file->getPath(); $file = \App\Models\CustomerFile::findOrFail($id);
} $filename = $file->original_name;
if ($disk === 'travel_user'){ $path = $file->getPath();
$file = \App\Models\CustomerFewoFile::findOrFail($id); break;
$filename = $file->original_name; case 'travel_user':
$path = $file->getPath(); $file = \App\Models\CustomerFewoFile::findOrFail($id);
} $filename = $file->original_name;
$path = $file->getPath();
if ($disk === 'booking'){ break;
$file = \App\Models\BookingFile::findOrFail($id); case 'booking':
$filename = $file->original_name; $file = \App\Models\BookingFile::findOrFail($id);
$path = $file->getPath(); $filename = $file->original_name;
} $path = $file->getPath();
break;
if ($disk === 'general'){ case 'general':
$file = \App\Models\GeneralFile::findOrFail($id); $file = \App\Models\GeneralFile::findOrFail($id);
$filename = $file->original_name; $filename = $file->original_name;
$path = $file->getPath(); $path = $file->getPath();
} break;
case 'booking_fewo':
if ($disk === 'booking_fewo'){ $file = \App\Models\TravelUserBookingFile::findOrFail($id);
$file = \App\Models\TravelUserBookingFile::findOrFail($id); $filename = $file->original_name;
$filename = $file->original_name; $path = $file->getPath();
$path = $file->getPath(); break;
} case 'lead':
$file = \App\Models\LeadFile::findOrFail($id);
if ($disk === 'lead'){ $filename = $file->original_name;
$file = \App\Models\LeadFile::findOrFail($id); $path = $file->getPath();
$filename = $file->original_name; break;
$path = $file->getPath(); case 'cms_file':
} $file = \App\Models\CMSContent::findOrFail($id);
$filename = $file->name;
$path = $file->getPath();
if ($disk === 'cms_file'){ break;
$file = \App\Models\CMSContent::findOrFail($id); case 'booking_document':
$filename = $file->name; $file = \App\Models\BookingDocument::findOrFail($id);
$path = $file->getPath(); $filename = $file->name;
$path = $file->getPath();
break;
} }
if (file_exists($path)) { if (file_exists($path)) {
if($do === "download"){
return Response::download($path, $filename); switch ($do) {
case 'file':
return Response::file($path);
break;
case 'download':
return Response::download($path, $filename);
break;
case 'url':
return $path.$filename;
break;
} }
return Response::file($path);
} }
} }

View file

@ -202,7 +202,6 @@ class ContentTreeController extends Controller
$data['user_id'] = \Auth::user()->id; $data['user_id'] = \Auth::user()->id;
$data['active'] = isset($data['active']) ? true : false; $data['active'] = isset($data['active']) ? true : false;
$data['search'] = isset($data['search']) ? true : false; $data['search'] = isset($data['search']) ? true : false;
if (isset($data['action'])) { if (isset($data['action'])) {
switch ($data['action']) { switch ($data['action']) {
case 'tree-content' : case 'tree-content' :

View file

@ -2,17 +2,19 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Carbon;
use Request;
use App\Models\Lead; use App\Models\Lead;
use App\Models\LeadFile; use App\Models\LeadFile;
use App\Models\LeadMail; use App\Models\LeadMail;
use App\Models\LeadNotice; use App\Models\LeadNotice;
use App\Models\StatusHistory;
use App\Models\LeadParticipant; use App\Models\LeadParticipant;
use App\Repositories\LeadRepository; use App\Models\StatusHistory;
use App\Repositories\CustomerRepository; use App\Repositories\CustomerRepository;
use App\Repositories\LeadFileRepository; use App\Repositories\LeadFileRepository;
use App\Repositories\LeadRepository;
use App\Services\Util;
use Carbon;
use Request;
use Session;
class LeadController extends Controller class LeadController extends Controller
{ {
@ -38,6 +40,7 @@ class LeadController extends Controller
public function detail($id) public function detail($id)
{ {
if($id === "new") { if($id === "new") {
$lead = new Lead(); $lead = new Lead();
$id = 'new'; $id = 'new';
@ -47,6 +50,7 @@ class LeadController extends Controller
$lead->getPassolutionPDF(true); $lead->getPassolutionPDF(true);
$id = $lead->id; $id = $lead->id;
} }
$data = [ $data = [
'lead' => $lead, 'lead' => $lead,
'id' => $id, 'id' => $id,
@ -59,24 +63,34 @@ class LeadController extends Controller
public function store($id) public function store($id)
{ {
$data = Request::all(); $data = Request::all();
if(!isset($data['action'])){
abort(403, 'keine Action');
}
//save
if($data['action'] === 'createBooking'){ if($data['action'] === 'createBooking'){
$lead = $this->leadRepo->createBooking($id, $data); $lead = $this->leadRepo->createBooking($id, $data);
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
return redirect(route('lead_detail', [$id]).'#collapseLeadBooking'); return redirect(route('lead_detail', [$id]).'#collapseLeadBooking');
} }
if($data['action'] === 'saveCustomer'){
if($data['action'] === 'saveCustomer' || $data['action'] === 'saveLead' || $data['action'] === 'saveStatus' || $data['action'] === 'update_lead_participant'){
//@dd($data);
$customer = $this->custRepo->updateCustomerFromLead($id, $data); $customer = $this->custRepo->updateCustomerFromLead($id, $data);
\Session()->flash('alert-save', '1'); $lead = $this->leadRepo->updateLead($id, $data);
$lead = $this->leadRepo->updateLeadParticipant($id, $data);
}
if($data['action'] === 'saveCustomer'){
return redirect(route('lead_detail', [$id]).'#collapseLeadCustomer'); return redirect(route('lead_detail', [$id]).'#collapseLeadCustomer');
} }
if($data['action'] === 'saveLead'){ if($data['action'] === 'saveLead'){
$lead = $this->leadRepo->updateLead($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('lead_detail', [$id]).'#collapseLeadDetail'); return redirect(route('lead_detail', [$id]).'#collapseLeadDetail');
} }
if($data['action'] === 'update_lead_participant'){
return redirect(route('lead_detail', [$lead->id])."#collapseBookingParticipant");
}
if($data['action'] === 'saveStatus'){ if($data['action'] === 'saveStatus'){
$lead = $this->leadRepo->updateLeadStatus($id, $data); $lead = $this->leadRepo->updateLeadStatus($id, $data);
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
@ -93,11 +107,7 @@ class LeadController extends Controller
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
return redirect(route('lead_detail', [$lead->id])."#collapseLeadNotice"); return redirect(route('lead_detail', [$lead->id])."#collapseLeadNotice");
} }
if($data['action'] === 'update_lead_participant'){
$lead = $this->leadRepo->updateLeadParticipant($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('lead_detail', [$lead->id])."#collapseBookingParticipant");
}
return back(); return back();
@ -170,6 +180,11 @@ class LeadController extends Controller
if($del === 'lead') { if($del === 'lead') {
$lead = Lead::findOrFail($id); $lead = Lead::findOrFail($id);
if($lead->bookings->count()){
\Session()->flash('alert-error', 'Kann nicht gelöscht werden, die Anfrage hat Buchungen');
return redirect(route('lead_detail', [$lead->id])."#collapseLeadBooking");
}
//Files //Files
$leadFiles = LeadFile::where('lead_id', $lead->id)->get(); $leadFiles = LeadFile::where('lead_id', $lead->id)->get();
foreach ($leadFiles as $leadFile) { foreach ($leadFiles as $leadFile) {
@ -233,21 +248,7 @@ class LeadController extends Controller
return Carbon::parse($lead->request_date)->format(\Util::formatDateDB()); return Carbon::parse($lead->request_date)->format(\Util::formatDateDB());
}) })
->addColumn('travel_country', function (Lead $lead) { ->addColumn('travel_country', function (Lead $lead) {
$out = ""; return $lead->getTravelCountryDestco();
if($lead->bookings->count()){
$out = '<span class="badge badge-success">';
foreach ($lead->bookings as $booking){
if($booking->travel_country_id && $booking->travel_country) {
$out .= $booking->travel_country->destco;
}
}
$out .= '</span>';
return $out;
}
if($lead->travel_country){
return '<span class="badge badge-secondary">'.$lead->travel_country->destco.'</span>';
}
return "-";
}) })
->addColumn('status', function (Lead $lead) { ->addColumn('status', function (Lead $lead) {
@ -285,6 +286,7 @@ class LeadController extends Controller
}) })
->orderColumn('id', 'id $1') ->orderColumn('id', 'id $1')
->orderColumn('customer_id', 'customer_id $1') ->orderColumn('customer_id', 'customer_id $1')
->orderColumn('request_date', 'request_date $1')
->orderColumn('status', 'status_id $1') ->orderColumn('status', 'status_id $1')
->orderColumn('last_lead_email', function ($query, $order) { ->orderColumn('last_lead_email', function ($query, $order) {

View file

@ -54,7 +54,7 @@ class LeadMailController extends Controller
\Session()->flash('alert-success', __('E-Mail weitergeleitet')); \Session()->flash('alert-success', __('E-Mail weitergeleitet'));
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function delete($id){ public function delete($id){
@ -110,14 +110,14 @@ class LeadMailController extends Controller
}else{ }else{
\Session()->flash('alert-success', "Mail gesendet!"); \Session()->flash('alert-success', "Mail gesendet!");
} }
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }
public function replyMail(LeadMailRepository $LeadMailRepository){ public function replyMail(LeadMailRepository $LeadMailRepository){
$data = Request::all(); $data = Request::all();
$LeadMailRepository->replyStore($data); $LeadMailRepository->replyStore($data);
\Session()->flash('alert-success', "Mail gespeichert!"); \Session()->flash('alert-success', "Mail gespeichert!");
return back(); return back()->with('collapse_shows', $data['collapse_shows'] ? $data['collapse_shows'] : []);
} }

View file

@ -2,19 +2,19 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Request;
use DataTables;
use Carbon\Carbon;
use App\Models\Status;
use App\Models\Airline; use App\Models\Airline;
use App\Models\Airport;
use App\Models\Booking; use App\Models\Booking;
use App\Models\SfGuardUser;
use App\Models\CustomerMail; use App\Models\CustomerMail;
use App\Models\SfGuardUser;
use App\Models\Status;
use App\Models\Sym\TravelCountry;
use App\Models\TravelAgenda; use App\Models\TravelAgenda;
use App\Models\TravelCompany; use App\Models\TravelCompany;
use App\Models\Sym\TravelCountry;
use App\Models\TravelCountryService;
use App\Repositories\CustomerMailRepository; use App\Repositories\CustomerMailRepository;
use Carbon\Carbon;
use DataTables;
use Request;
class RequestController extends Controller class RequestController extends Controller
{ {
@ -31,6 +31,8 @@ class RequestController extends Controller
$travel_countries = Booking::join('travel_country', 'travel_country_id', '=', 'travel_country.id')->get()->pluck('name', 'travel_country_id')->unique()->toArray(); $travel_countries = Booking::join('travel_country', 'travel_country_id', '=', 'travel_country.id')->get()->pluck('name', 'travel_country_id')->unique()->toArray();
$filter_lead_status = Status::get()->pluck('name', 'id')->toArray(); $filter_lead_status = Status::get()->pluck('name', 'id')->toArray();
$filter_travel_company = TravelCompany::get()->pluck('name', 'id')->toArray(); $filter_travel_company = TravelCompany::get()->pluck('name', 'id')->toArray();
$filter_airports = Airport::get()->pluck('name', 'id')->toArray();
$filter_paying_out = Booking::$paying_out_types; $filter_paying_out = Booking::$paying_out_types;
$filter_paying_out_status = Booking::$paying_out_status_types; $filter_paying_out_status = Booking::$paying_out_status_types;
$filter_refund = Booking::$refund_types; $filter_refund = Booking::$refund_types;
@ -56,7 +58,8 @@ class RequestController extends Controller
'filter_refund' => $filter_refund, 'filter_refund' => $filter_refund,
'filter_xx_tkt' => $filter_xx_tkt, 'filter_xx_tkt' => $filter_xx_tkt,
'filter_airlines' => $filter_airlines, 'filter_airlines' => $filter_airlines,
'filter_sf_guard_user' => $filter_sf_guard_user 'filter_sf_guard_user' => $filter_sf_guard_user,
'filter_airports' => $filter_airports,
]; ];
return view('request.index', $data); return view('request.index', $data);
} }
@ -128,6 +131,9 @@ class RequestController extends Controller
if(Request::get('travel_option_airline_id') != ""){ if(Request::get('travel_option_airline_id') != ""){
$query->where('airline_ids', 'LIKE', '%'.Request::get('travel_option_airline_id').'%'); $query->where('airline_ids', 'LIKE', '%'.Request::get('travel_option_airline_id').'%');
} }
if(Request::get('travel_option_airport_id') != ""){
$query->where('airport_id', '=', Request::get('travel_option_airport_id'));
}
// $query->where('end_date', '<=', $now); // $query->where('end_date', '<=', $now);
@ -393,6 +399,9 @@ class RequestController extends Controller
->addColumn('travel_company_id', function (Booking $booking) { ->addColumn('travel_company_id', function (Booking $booking) {
return '<span data-order="'.($booking->travel_company_id ? $booking->travel_company_id : 0).'">'.($booking->travel_company ? $booking->travel_company->name : "-").'</span>'; return '<span data-order="'.($booking->travel_company_id ? $booking->travel_company_id : 0).'">'.($booking->travel_company ? $booking->travel_company->name : "-").'</span>';
}) })
->addColumn('airport_id', function (Booking $booking) {
return '<span data-order="'.($booking->airport_id ? $booking->airport_id : 0).'">'.($booking->airport ? $booking->airport->name : "-").'</span>';
})
->addColumn('comfort', function (Booking $booking) { ->addColumn('comfort', function (Booking $booking) {
return $booking->comfort ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>'; return $booking->comfort ? ' <span data-order="1" class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
}) })
@ -515,7 +524,7 @@ class RequestController extends Controller
->orderColumn('xx_tkt', 'xx_tkt_date $1') ->orderColumn('xx_tkt', 'xx_tkt_date $1')
->orderColumn('comfort', 'comfort $1') ->orderColumn('comfort', 'comfort $1')
//->orderColumn('travel_documents', 'travel_documents $1') //->orderColumn('travel_documents', 'travel_documents $1')
->rawColumns(['action_lead_edit', 'comfort', 'lead_id', 'booking_participants_pass', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'travel_company_id', 'sf_guard_user_id', 'airline_ids', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_services', 'booking_notice', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt']) ->rawColumns(['action_lead_edit', 'comfort', 'lead_id', 'booking_participants_pass', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'travel_company_id', 'sf_guard_user_id', 'airline_ids', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_services', 'booking_notice', 'paying_out', 'paying_out_status', 'airline_id', 'airport_id', 'refund', 'hold', 'xx_tkt'])
->make(true); ->make(true);
} }
} }

View file

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers\Settings;
use Request;
use App\Models\Airport;
use App\Models\Booking;
use App\Http\Controllers\Controller;
class AirportController extends Controller
{
public function __construct()
{
$this->middleware(['superadmin', '2fa']);
}
public function index($step = false)
{
$data = [
'airports' => Airport::all(),
];
return view('settings.airport.index', $data);
}
public function update(){
$data = Request::all();
if($data['id'] === "new"){
$model = Airport::create([
'code' => $data['code'],
'name' => $data['name'],
'city' => $data['city'],
'country' => $data['country'],
'active' => isset($data['active']) ? true : false,
]);
}else{
$model = Airport::find($data['id']);
$model->name = $data['name'];
$model->code = $data['code'];
$model->city = isset($data['city']) ? $data['city'] : NULL;
$model->country = isset($data['country']) ? $data['country'] : NULL;
$model->active = isset($data['active']) ? true : false;
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('admin_settings_airport'));
}
public function delete($id){
if(Booking::where('airport_id', $id)->count()){
\Session()->flash('alert-error', 'Eintrag wird verwendet');
return redirect()->back();
}
$model = Airport::findOrFail($id);
$model->delete();
\Session()->flash('alert-success', 'Eintrag gelöscht');
return redirect()->back();
}
}

View file

@ -53,19 +53,24 @@ class TravelProgramController extends Controller
if(!isset($data['action'])){ if(!isset($data['action'])){
abort(403, 'keine Action'); abort(403, 'keine Action');
} }
//save
$program = $this->travelProgramRepo->updateGeneral($id, $data);
$program = $this->travelProgramRepo->updateDetail($id, $data);
$program = $this->travelProgramRepo->updatePage($id, $data);
\Session()->flash('alert-save', '1');
if($data['action'] === 'saveGeneral'){ if($data['action'] === 'saveGeneral'){
$program = $this->travelProgramRepo->updateGeneral($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('travel_program_detail', [$program->id])."#collapseBookingNotice"); return redirect(route('travel_program_detail', [$program->id])."#collapseBookingNotice");
} }
if($data['action'] === 'saveDetails'){ if($data['action'] === 'saveDetails'){
$program = $this->travelProgramRepo->updateDetail($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('travel_program_detail', [$program->id])."#collapseTravelProgramDetails"); return redirect(route('travel_program_detail', [$program->id])."#collapseTravelProgramDetails");
} }
if($data['action'] === 'savePage'){
return redirect(route('travel_program_detail', [$program->id])."#collapseTravelProgramPage");
}
return redirect(route('travel_program_detail', [$id])); return redirect(route('travel_program_detail', [$id]));
} }
/* /*

View file

@ -84,6 +84,10 @@ class TravelUserBookingFewoController extends Controller
public function store($id) public function store($id)
{ {
$data = Request::all(); $data = Request::all();
if(!isset($data['action'])){
abort(403, 'keine Action');
}
if($data['action'] === 'save_notice'){ if($data['action'] === 'save_notice'){
$travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data); $travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data);
\Session()->flash('alert-save', '1'); \Session()->flash('alert-save', '1');
@ -352,6 +356,7 @@ class TravelUserBookingFewoController extends Controller
}) })
->addColumn('is_calendar', function (TravelUserBookingFewo $travel_user_booking_fewo) { ->addColumn('is_calendar', function (TravelUserBookingFewo $travel_user_booking_fewo) {
$back = "<div class='no-break'>"; $back = "<div class='no-break'>";
$back .= get_active_badge($travel_user_booking_fewo->is_calendar_traum_fewo, "Traum Direkt")." ";
$back .= get_active_badge($travel_user_booking_fewo->is_calendar_fewo_direct, "FEWO Direkt")." "; $back .= get_active_badge($travel_user_booking_fewo->is_calendar_fewo_direct, "FEWO Direkt")." ";
$back .= get_active_badge($travel_user_booking_fewo->is_calendar_hrs, "HRS")." "; $back .= get_active_badge($travel_user_booking_fewo->is_calendar_hrs, "HRS")." ";
$back .= get_active_badge($travel_user_booking_fewo->is_calendar_stern_tours, "STERN TOURS"); $back .= get_active_badge($travel_user_booking_fewo->is_calendar_stern_tours, "STERN TOURS");

View file

@ -11,7 +11,6 @@ class MiddleGoogle2FA
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
$AuthGoogle2FA = app(AuthGoogle2FA::class)->init($request); $AuthGoogle2FA = app(AuthGoogle2FA::class)->init($request);
if(!Auth::user()->isGoogle2Fa()){ if(!Auth::user()->isGoogle2Fa()){
\App\Services\MyGoogle2FA::logout(); \App\Services\MyGoogle2FA::logout();
return $AuthGoogle2FA->makeActiveOneTimePasswordResponse(); return $AuthGoogle2FA->makeActiveOneTimePasswordResponse();

View file

@ -0,0 +1,176 @@
<?php
namespace App\Libraries;
use App\Models\Coupon;
use App\Services\Util;
use App\Libraries\CouponPDF;
class CreateCouponPDF {
protected $pdfRenderer;
protected $coupon;
protected $styles = array();
protected $pdf;
public function __construct(Coupon $coupon)
{
$this->coupon = $coupon;
}
public function create(){
// initiate FPDI
$pdf = new CouponPDF();
if($this->coupon->text == NULL && $this->coupon->value == 50.00){
$is_static_coupon = true;
$pdf->_set('is_static_coupon', true);
}else{
$is_static_coupon = false;
$pdf->_set('is_static_coupon', false);
}
$pdf->AddFont('Helvetica', '', 'helvetica.php');
$pdf->AddPage('P', array(210, 297));
if ($this->coupon->isLegal()) {
$pdf->SetXY(20, 90);
$pdf->SetTextColor(230, 10, 10);
$pdf->SetFont('Helvetica', 'B', 28);
$pdf->Cell(80, 20, utf8_decode('Der Gutschein ist nicht mehr gültig!'), 0, 0, 'L');
}
if(!$is_static_coupon){
$pdf->SetXY(30, 55);
$pdf->SetTextColor(16, 77, 140);
$pdf->SetFont('Helvetica', 'B', 50);
$pdf->Cell(80, 20, Util::_number_format($this->coupon->value), 0, 0, 'L');
}
$pdf->SetDrawColor(16, 77, 140);
$pdf->SetFillColor(16, 77, 140);
$pdf->SetLineWidth(0.4);
$pdf->Rect(126, 31, 74, 20, 'DF');
$pdf->SetTextColor(255,255,255);
$x = 128;
$y = 32;
$border = 0;
$pdf->SetXY($x, $y);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(30, 6, "Nummer:", $border, 0, 'L');
$pdf->SetFont('Helvetica', '', 10);
$pdf->Cell(40, 6, $this->coupon->number, $border, 0, 'R');
$y += 6;
$pdf->SetXY($x, $y);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(30, 6, utf8_decode('Gültig vom:'), $border, 0, 'L');
$pdf->SetFont('Helvetica', '', 10);
$pdf->Cell(40, 6, Util::_format_date($this->coupon->issue_date), $border, 0, 'R');
$y += 6;
$pdf->SetXY($x, $y);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(30, 6, utf8_decode('Gültig bis:'), $border, 0, 'L');
$pdf->SetFont('Helvetica', '', 10);
$pdf->Cell(40, 6, Util::_format_date($this->coupon->valid_date), $border, 0, 'R');
//$pdf->SetDrawColor(16, 77, 140);
$pdf->SetFillColor(16, 77, 140);
$pdf->Rect(126, 56, 74, 7.5, 'DF');
$pdf->Rect(126, 56, 74, 35, 'D');
$x = 128;
$y = 56;
$pdf->SetXY($x, $y);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(40, 7.5, utf8_decode('Ausgestellt für:'), $border, 0, 'L');
$pdf->SetTextColor(16, 77, 140);
$pdf->SetFont('Helvetica', '', 10);
$customerName = ($this->coupon->customer && $this->coupon->customer->salutation ? $this->coupon->customer->salutation->name . ' ' : '' )
. ($this->coupon->customer->title ? $this->coupon->customer->title . ' ' : '' )
. $this->coupon->customer->fullName();
$customerStreet = $this->coupon->customer ? $this->coupon->customer->street : '';
$customerRegion = $this->coupon->customer->zip ? $this->coupon->customer->zip." " : '';
$customerRegion .= $this->coupon->customer->city ? $this->coupon->customer->city : '';
$y += 12;
$pdf->SetXY($x, $y);
$pdf->Cell(70, 5.5, utf8_decode($customerName), $border, 0, 'L');
$y += 5.5;
$pdf->SetXY($x, $y);
$pdf->Cell(70, 5.5, utf8_decode($customerStreet), $border, 0, 'L');
$y += 5.5;
$pdf->SetXY($x, $y);
$pdf->Cell(70, 5.5, utf8_decode($customerRegion), $border, 0, 'L');
$x = 128;
$y = 106;
$pdf->SetXY($x, $y);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Helvetica', 'B', 10);
$sender = 'STERN TOURS GmbH'."\n".
'Emser Straße 3'."\n".
'10719 Berlin'."\n\n".
'Fon: +49 (0) 30 700 9410 0'."\n".
'Fax: +49 (0) 30 700 9410 44'."\n".
'e-Mail: stern@sterntours.de'."\n".
'Internet: www.sterntours.de'."\n";
$pdf->MultiCell(70, 5.5, utf8_decode($sender), $border, 'L');
if($is_static_coupon) {
$x = 12;
$y = 155.5;
$pdf->SetXY($x, $y);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(130, 5.5, utf8_decode('Gutscheinbedingungen:'), $border, 0, 'L');
$pdf->SetFont('Helvetica', '', 7);
$terms = '- gültig bei Pauschalreisen, Last Minute & More, Hotel und Ferienhäuser'."\n".
'- nur Einlösbar bei Buchungen mit einem Gesamtreisepreis von mind. Euro 750,-'."\n".
'- Der Gutscheinbetrag wird Ihnen nach Reiseantritt der nächsten Reise per'."\n".
' Banküberweisung zugestellt'."\n".
'- der Reise-Gutschein kann bis einen Tag vor Abreise eingelöst werden'."\n".
'- pro Buchung kann nur ein Reise-Gutschein eingelöst werden'."\n".
'- der Reise-Gutschein kann nicht auf Stornokosten angerechnet werden'."\n".
'- bei Stornierung der Reise wird der Reise-Gutschein ungültig und nicht ausgezahlt'."\n".
'- der Reise-Gutschein ist nicht übertragbar'."\n";
$y += 5.5;
$pdf->SetXY($x, $y);
$pdf->MultiCell(130, 3.5, utf8_decode($terms), $border, 'L');
}else{
$x = 12;
$y = 157;
$pdf->SetXY($x, $y);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Helvetica', '', 9);
if( $this->coupon->text !== ""){
$text = $this->coupon->text;
$text = preg_replace("/\r\n|\n|\r/", "\n", $text);
$pdf->MultiCell(180, 4.2, utf8_decode($text), 0, 'L');
}
}
$this->pdf = $pdf;
}
public function output($filename, $cd){
if($cd){
return $this->pdf->Output($filename, 'D');
}
return $this->pdf->Output();
}
}
?>

View file

@ -0,0 +1,63 @@
<?php
namespace App\Libraries;
use App\Libraries\CouponPDF;
use App\Models\Coupon;
use Storage;
class CreatePDF{
protected $view;
protected $pdf;
protected $prepath;
protected $disk;
public function __construct($view, $disk = 'public')
{
$this->view = $view;
$this->disk = $disk;
$this->prepath = Storage::disk($disk)->getAdapter()->getPathPrefix();
}
public function create($data, $name='test.pdf', $output='stream', $path = false){
header('Content-type: text/html; charset=UTF-8') ;//chrome
//dd($data);
$pdf = app('dompdf.wrapper');
$pdf->getDomPDF()->set_option("enable_php", true);
$pdf->loadView($this->view, $data);
$pdf->setPaper('A4', 'portrait');
if($output === 'stream'){
//file???
return $pdf->stream($name);
}
if($output === 'download'){
//download
return $pdf->download($name);
}
if($output === 'save'){
if($path){
$pdf->save($path.$name);
return $path.$name;
}
}
}
public function merger($dir, $filename, $template){
$pdfMerger = new MyPDFMerger();
$pdfMerger->addPDF($this->prepath.$dir.$filename);
$file = $pdfMerger->myMerge('string', $filename, $template);
Storage::disk($this->disk)->put($dir.$filename, $file);
}
public function setPrePath($path){
$this->prepath = $path;
}
}
?>

View file

@ -0,0 +1,47 @@
<?php
namespace App\Libraries;
use App\Libraries\CouponPDF;
use App\Models\Coupon;
use Storage;
class CreatePDFCoupon{
protected $view;
protected $pdf;
public function __construct($view)
{
$this->view = $view;
}
public function create($data, $name='test.pdf', $output='stream', $path = false){
header('Content-type: text/html; charset=UTF-8') ;//chrome
//dd($data);
$pdf = app('dompdf.wrapper');
$pdf->getDomPDF()->set_option("enable_php", true);
$pdf->loadView($this->view, $data);
$customPaper = array(0, 0, 595.28, 283,47);
$pdf->setPaper($customPaper, 'portrait');
// $pdf->setPaper('A4', 'portrait');
if($output === 'stream'){
return $pdf->stream($name);
}
if($output === 'download'){
return $pdf->download($name);
}
if($output === 'save'){
if($path){
$pdf->save($path.$name);
return $path.$name;
}
}
}
}
?>

View file

@ -0,0 +1,188 @@
<?php
namespace App\Libraries;
//use FPDI in myMerge v2
//use FPDF;
//use FPDI;
class MyPDFMerger
{
private $_files; //['form.pdf'] ["1,2,4, 5-19"]
private $_fpdi;
public function __construct()
{
/* if(!class_exists("FPDF")) {
require_once(__DIR__.'/fpdf/fpdf.php');
}
if(!class_exists("FPDI")) {
require_once(__DIR__.'/fpdi/fpdi.php');
}*/
}
public function addPDF($filepath, $pages = 'all')
{
if (file_exists($filepath)) {
if (strtolower($pages) != 'all') {
$pages = $this->_rewritepages($pages);
}
$this->_files[] = array($filepath, $pages);
} else {
throw new \exception("Could not locate PDF on '$filepath'");
}
return $this;
}
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;
$fpdi = new \setasign\Fpdi\Fpdi();
$first = 1;
//
//merger operations
foreach ($this->_files as $file) {
$filename = $file[0];
$filepages = $file[1];
$count = $fpdi->setSourceFile($filename);
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$count = $fpdi->setSourceFile($filename);
$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');
if($first == 1){
$first = 2;
}
$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;
$size = $fpdi->getTemplateSize($template);
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
if($theme){
$fpdi->setSourceFile(__DIR__ . '/../../public/pdf/'.$theme.'-'.$first.'.pdf');
if($first == 1){
$first = 2;
}
$backId = $fpdi->importPage(1);
$fpdi->useTemplate($backId);
}
$fpdi->useTemplate($template);
}
}
//after first file (invoice) on bpaper
$slug = false;
}
//output operations
$mode = $this->_switchmode($outputmode);
if ($mode == 'S') {
return $fpdi->Output($outputpath, 'S');
} else {
if ($fpdi->Output($outputpath, $mode) == '') {
return true;
} else {
throw new \exception("Error outputting PDF to '$outputmode'.");
return false;
}
}
}
/**
* FPDI uses single characters for specifying the output location. Change our more descriptive string into proper format.
* @param $mode
* @return Character
*/
private function _switchmode($mode)
{
switch (strtolower($mode)) {
case 'download':
return 'D';
break;
case 'browser':
return 'I';
break;
case 'file':
return 'F';
break;
case 'string':
return 'S';
break;
default:
return 'I';
break;
}
}
/**
* Takes our provided pages in the form of 1,3,4,16-50 and creates an array of all pages
* @param $pages
* @return array
* @throws exception
*/
private function _rewritepages($pages)
{
$pages = str_replace(' ', '', $pages);
$part = explode(',', $pages);
//parse hyphens
foreach ($part as $i) {
$ind = explode('-', $i);
if (count($ind) == 2) {
$x = $ind[0]; //start page
$y = $ind[1]; //end page
if ($x > $y): throw new \exception("Starting page, '$x' is greater than ending page '$y'.");
return false; endif;
//add middle pages
while ($x <= $y): $newpages[] = (int)$x;
$x++; endwhile;
} else {
$newpages[] = (int)$ind[0];
}
}
return $newpages;
}
}
/*
$pdf = new PDFMerger;
$pdf->addPDF('samplepdfs/one.pdf', '1, 3, 4')
->addPDF('samplepdfs/two.pdf', '1-2')
->addPDF('samplepdfs/three.pdf', 'all')
->merge('file', 'samplepdfs/TEST2.pdf');
//REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options
//You do not need to give a file path for browser, string, or download - just the name.
*/

43
app/Models/Airport.php Normal file
View file

@ -0,0 +1,43 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Airport
*
* @property int $id
* @property string $code
* @property string $name
* @property string $city
* @property string $country
* @property bool $active
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class Airport extends Model
{
protected $connection = 'mysql';
protected $table = 'airports';
protected $casts = [
'active' => 'bool'
];
protected $fillable = [
'code',
'name',
'city',
'country',
'active'
];
}

View file

@ -85,4 +85,52 @@ class Arrangement extends Model
{ {
return $this->belongsTo(ArrangementTemplate::class, 'template_id'); return $this->belongsTo(ArrangementTemplate::class, 'template_id');
} }
public function arrangement_type()
{
return $this->belongsTo(ArrangementType::class, 'type_id');
}
public function getDataAsMap()
{
$rawData = $this->attributes['data_s'];
$data = json_decode('{'. $rawData .'}', true);
if (is_array($data))
{
return $data;
}
$entries = preg_split("/[\r\n;]+\s*/", $rawData, -1, PREG_SPLIT_NO_EMPTY);
$ret = array();
foreach ($entries as $entry)
{
$map = preg_split('/:\s*/', $entry, -1, PREG_SPLIT_NO_EMPTY);
if (count($map) == 2)
{
$ret[$map[0]] = $map[1];
}
}
return $ret;
}
public function getDataS()
{
$rawData = $this->attributes['data_s'];
$data = json_decode('{'. $rawData .'}', true);
if (is_array($data))
{
$str = '';
$i = 0;
foreach ($data as $k => $v)
{
if (++$i > 0)
{
$str .= '';
}
$str .= $k .' '. $v;
}
return $str;
}
return $rawData;
}
} }

View file

@ -203,6 +203,7 @@ class Booking extends Model
'new_drafts' => 'bool', 'new_drafts' => 'bool',
'sf_guard_user_id' => 'int', 'sf_guard_user_id' => 'int',
'branch_id' => 'int', 'branch_id' => 'int',
'airport_id' => 'int',
'service_fee' => 'float', 'service_fee' => 'float',
'travel_country_id' => 'int', 'travel_country_id' => 'int',
'travel_category_id' => 'int', 'travel_category_id' => 'int',
@ -282,6 +283,7 @@ class Booking extends Model
'paying_out', 'paying_out',
'paying_out_status', 'paying_out_status',
//'airline_id', //'airline_id',
'airport_id',
'airline_ids', 'airline_ids',
'refund', 'refund',
'refund_date', 'refund_date',
@ -400,6 +402,11 @@ class Booking extends Model
return $this->belongsTo(TravelCompany::class); return $this->belongsTo(TravelCompany::class);
} }
public function airport()
{
return $this->belongsTo(Airport::class, 'airport_id');
}
/* public function travel_country() /* public function travel_country()
{ {
return $this->belongsTo(TravelCountry::class, 'travel_country_id', 'crm_id'); return $this->belongsTo(TravelCountry::class, 'travel_country_id', 'crm_id');
@ -460,6 +467,11 @@ class Booking extends Model
return $this->hasMany(Participant::class); return $this->hasMany(Participant::class);
} }
public function participant_salutation()
{
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
}
public function service_provider_entries() public function service_provider_entries()
{ {
return $this->hasMany(ServiceProviderEntry::class); return $this->hasMany(ServiceProviderEntry::class);
@ -471,6 +483,11 @@ class Booking extends Model
return $this->hasMany(CustomerMail::class, 'booking_id', 'id'); return $this->hasMany(CustomerMail::class, 'booking_id', 'id');
} }
public function customer_mails_reverse()
{
return $this->hasMany(CustomerMail::class, 'booking_id', 'id')->orderBy('id', 'DESC');
}
public function customer_mails_sent_at() public function customer_mails_sent_at()
{ {
return $this->hasMany(CustomerMail::class, 'booking_id')->orderBy('sent_at', 'ASC'); return $this->hasMany(CustomerMail::class, 'booking_id')->orderBy('sent_at', 'ASC');
@ -521,6 +538,11 @@ class Booking extends Model
return $this->hasMany(BookingFile::class); return $this->hasMany(BookingFile::class);
} }
public function booking_documents()
{
return $this->hasMany(BookingDocument::class, 'booking_id');
}
public function booking_country_services() public function booking_country_services()
{ {
return $this->hasMany(BookingCountryService::class, 'booking_id'); return $this->hasMany(BookingCountryService::class, 'booking_id');
@ -991,4 +1013,31 @@ class Booking extends Model
} }
return $this->customer_mails->where('dir', $dir)->count(); return $this->customer_mails->where('dir', $dir)->count();
} }
/*DOCUMENTS*/
public function hasDocument($identifier){
return $this->booking_documents->where('identifier', $identifier)->count() ? true : false;
}
public function getDocument($identifier){
return $this->booking_documents->where('identifier', $identifier)->first();
}
public function isDepositPossible($maxIntervalDays = false)
{
$maxIntervalDays = $maxIntervalDays ? $maxIntervalDays : config('booking.max_interval_days');
$diffInDays = $this->booking_date->diffInDays($this->start_date, false);
return $diffInDays > $maxIntervalDays;
}
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(){
return $this->getPriceRaw() - $this->getConfirmationDeposit();
}
} }

View file

@ -0,0 +1,134 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class BookingDocument
*
* @property int $id
* @property int|null $booking_id
* @property int|null $customer_id
* @property int|null $lead_id
* @property string $identifier
* @property string $filename
* @property string $dir
* @property string $original_name
* @property string $ext
* @property string $mine
* @property int $size
* @property Carbon $date
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Booking|null $booking
* @property Customer|null $customer
* @property Lead|null $lead
*
* @package App\Models
*/
class BookingDocument extends Model
{
protected $table = 'booking_documents';
protected $casts = [
'booking_id' => 'int',
'customer_id' => 'int',
'lead_id' => 'int',
'size' => 'int',
'data' => 'object',
'status' => 'int',
'booking_storno_id' => 'int',
'coupon_id' => 'int',
];
protected $dates = [
'date'
];
protected $fillable = [
'booking_id',
'customer_id',
'lead_id',
'coupon_id',
'booking_storno_id', //
'identifier',
'filename',
'dir',
'original_name',
'ext',
'mine',
'size',
'date',
'data',
'status'
];
/* Je nach identifier können verschiebene stati gesetzt werden
coupon 0 = nicht eingelöst 1 = eingelöst
*/
protected $status_type = [
0 => 'offen',
1 => 'erledigt',
];
public function booking()
{
return $this->belongsTo(Booking::class);
}
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function lead()
{
return $this->belongsTo(Lead::class);
}
public function coupon_id()
{
return $this->belongsTo(Coupon::class);
}
public function booking_storno()
{
return $this->belongsTo(BookingStorno::class);
}
public function getURL($do=false){
return route('storage_file', [$this->id, 'booking_document', $do]);
}
public function getPath(){
return \Storage::disk('public')->path($this->dir.$this->filename);
}
public function deleteFile(){
if(\Storage::disk('public')->exists($this->dir.$this->filename)){
\Storage::disk('public')->delete($this->dir.$this->filename);
}
}
public function formatBytes($precision = 2)
{
$size = $this->size;
if ($size > 0) {
$size = (int) $size;
$base = log($size) / log(1024);
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
} else {
return $size;
}
}
}

View file

@ -115,7 +115,7 @@ class BookingDraftItem extends Model
return $this->belongsTo('App\Models\DraftType', 'draft_type_id'); return $this->belongsTo('App\Models\DraftType', 'draft_type_id');
} }
public function getItemPrice(){ public function getItemPrice($return = false){
$adult = 0; $adult = 0;
$children = 0; $children = 0;
@ -138,9 +138,20 @@ class BookingDraftItem extends Model
$price = $this->price; $price = $this->price;
} }
*/ */
return ['adult'=>$adult, 'children'=>$children];
}
if($return == 'adult'){
return $adult;
}
if($return == 'children'){
return $children;
}
if($return == 'total'){
return $adult + $children;
}
return ['adult'=>$adult, 'children'=>$children];
}
public function getStartDateAttribute(){ public function getStartDateAttribute(){
return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date'])->format("d.m.Y") : ''; return isset($this->attributes['start_date']) ? Carbon::parse($this->attributes['start_date'])->format("d.m.Y") : '';

View file

@ -6,6 +6,7 @@
namespace App\Models; namespace App\Models;
use App\Services\Util;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -69,4 +70,72 @@ class BookingStorno extends Model
{ {
return $this->belongsTo(Booking::class); return $this->belongsTo(Booking::class);
} }
public function booking_document()
{
return $this->hasOne(BookingDocument::class, 'booking_storno_id', 'id');
}
public function getTotalFormatted()
{
return Util::_number_format($this->attributes['total']);
}
public function getTotalRaw()
{
return $this->attributes['total'];
}
public function setTotalAttribute($value)
{
$this->attributes['total'] = Util::_clean_float($value);
}
public function getStornoFormatted()
{
return Util::_number_format($this->attributes['storno']);
}
public function getStornoRaw()
{
return $this->attributes['storno'];
}
public function setStornoAttribute($value)
{
$this->attributes['storno'] = Util::_clean_float($value);
}
public function getStornoDateFormatted()
{
return isset($this->attributes['storno_date']) ? Carbon::parse($this->attributes['storno_date'])->format('d.m.Y') : '';
}
public function setStornoDateAttribute($value)
{
if (!$value) {
$this->attributes['storno_date'] = null;
} else {
$this->attributes['storno_date'] = Carbon::parse($value)->format('Y-m-d');
}
}
public function getStornoPrintFormatted()
{
return isset($this->attributes['storno_print']) ? Carbon::parse($this->attributes['storno_print'])->format('d.m.Y') : '';
}
public function setStornoPrintAttribute($value)
{
if (!$value) {
$this->attributes['storno_print'] = null;
} else {
$this->attributes['storno_print'] = Carbon::parse($value)->format('Y-m-d');
}
}
} }

View file

@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use App\Services\HTMLHelper; use App\Helper\HTMLHelper;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View file

@ -7,8 +7,9 @@
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection; use App\Services\Util;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
/** /**
* Class Coupon * Class Coupon
@ -78,6 +79,32 @@ class Coupon extends Model
'text' 'text'
]; ];
/**
* The "booted" method of the model.
*
* @return void
*/
protected static function boot()
{
parent::boot();
static::created(function ($model) {
$model->number = sprintf(
'%02u-%05u-%05u-%02u%02u',
date('y'),
$model->customer_id,
$model->id,
date('H'),
date('i')
);
$model->save();
});
}
public function create($product)
{
logger($product->id);
}
public function booking() public function booking()
{ {
return $this->belongsTo(Booking::class); return $this->belongsTo(Booking::class);
@ -88,6 +115,12 @@ class Coupon extends Model
return $this->belongsTo(Customer::class); return $this->belongsTo(Customer::class);
} }
public function booking_document()
{
return $this->hasOne(BookingDocument::class, 'coupon_id', 'id');
}
public function bookings() public function bookings()
{ {
return $this->hasMany(Booking::class); return $this->hasMany(Booking::class);
@ -95,6 +128,67 @@ class Coupon extends Model
public function isLegal(){ public function isLegal(){
//TODO //TODO
// return strtotime(date('Y-m-d')) <= strtotime($this->getValidDate());
return false; return false;
} }
public function getValueFormatted()
{
return Util::_number_format($this->attributes['value']);
}
public function getValueRaw()
{
return $this->attributes['value'];
}
public function setValueAttribute($value)
{
$this->attributes['value'] = Util::_clean_float($value);
}
public function getIssueDateFormatted()
{
return isset($this->attributes['issue_date']) ? Carbon::parse($this->attributes['issue_date'])->format('d.m.Y') : '';
}
public function setIssueDateAttribute($value)
{
if (!$value) {
$this->attributes['issue_date'] = null;
} else {
$this->attributes['issue_date'] = Carbon::parse($value)->format('Y-m-d');
}
}
public function getValidDateFormatted()
{
return isset($this->attributes['valid_date']) ? Carbon::parse($this->attributes['valid_date'])->format('d.m.Y') : '';
}
public function setValidDateAttribute($value)
{
if (!$value) {
$this->attributes['valid_date'] = null;
} else {
$this->attributes['valid_date'] = Carbon::parse($value)->format('Y-m-d');
}
}
public function getRedeemDateFormatted()
{
return isset($this->attributes['redeem_date']) ? Carbon::parse($this->attributes['redeem_date'])->format('d.m.Y') : '';
}
public function setRedeemDateAttribute($value)
{
if (!$value) {
$this->attributes['redeem_date'] = null;
} else {
$this->attributes['redeem_date'] = Carbon::parse($value)->format('Y-m-d');
}
}
} }

View file

@ -110,6 +110,12 @@ class Feedback extends Page
{ {
protected $table = 'page'; protected $table = 'page';
protected $fillable = [
'title', 'status', 'slug', 'date', 'content', 'content_new', 'box_body', 'description', 'pagetitle', 'keywords', 'order', 'active',
];
protected $casts = ['box_body' => 'array', 'date' => 'date', 'status' => 'boolean', 'active' => 'boolean'];
public static function boot() public static function boot()
{ {
parent::boot(); parent::boot();
@ -150,6 +156,24 @@ class Feedback extends Page
} }
} }
public function getContentAttribute()
{
return $this->attributes['content_new'] === null ? $this->attributes['content'] : $this->attributes['content_new'];
}
public function setContentNewAttribute($value)
{
if (!$value) {
$this->attributes['content_new'] = $value;
} else {
$this->attributes['content_new'] = HTMLHelper::filterHTML($value, ['src' => ['removeHost']], true);
}
}
public function getContentNewAttribute()
{
return $this->attributes['content_new'] === null ? $this->attributes['content'] : $this->attributes['content_new'];
}
public function getParentsArray(){ public function getParentsArray(){
@ -173,8 +197,19 @@ class Feedback extends Page
if (!$value) { if (!$value) {
$this->attributes['date'] = null; $this->attributes['date'] = null;
} else { } else {
$this->attributes['date'] = (new Carbon($value))->format('Y-m-d'); try {
$this->attributes['date']= Carbon::parse($value);
} catch (\Exception $e) {
$this->attributes['date'] = Carbon::now();
}
} }
} }
public function getImage($key){
//use box_body for images
if(isset($this->box_body[$key])){
return $this->box_body[$key];
}
return "";
}
} }

View file

@ -342,6 +342,25 @@ class Lead extends Model
return '<span data-order="0">-</span>'; return '<span data-order="0">-</span>';
} }
public function getTravelCountryDestco($badge = true){
$out = "";
if($this->bookings->count()){
$out .= $badge ? '<span class="badge badge-success">' : '';
foreach ($this->bookings as $booking){
if($booking->travel_country_id && $booking->travel_country) {
$out .= $booking->travel_country->destco;
}
}
$out .= $badge ? '</span>' : '';
return $out;
}
if($this->travel_country){
return $badge ? '<span class="badge badge-secondary">'.$this->travel_country->destco.'</span>' : $this->travel_country->destco;
}
return "-";
}
public function countLeadMailsBy($dir, $subdir=false){ public function countLeadMailsBy($dir, $subdir=false){
if($dir === 11){ if($dir === 11){
return $this->lead_mails->where('draft', true)->where('dir', '!=', 12)->count(); return $this->lead_mails->where('draft', true)->where('dir', '!=', 12)->count();

View file

@ -260,6 +260,11 @@ class TravelProgram extends Model
return $this->hasOne(Option::class, 'program_id'); return $this->hasOne(Option::class, 'program_id');
} }
public function page()
{
return $this->hasOne(Page::class, 'travel_program');
}
public function classes() public function classes()
{ {
return $this->hasMany(TravelClass::class, 'program_id'); return $this->hasMany(TravelClass::class, 'program_id');

View file

@ -149,6 +149,7 @@ class TravelUserBookingFewo extends Model
'price_total' => 'float', 'price_total' => 'float',
'travel_booking_fewo_channel_id' => 'int', 'travel_booking_fewo_channel_id' => 'int',
'is_calendar_fewo_direct' => 'bool', 'is_calendar_fewo_direct' => 'bool',
'is_calendar_traum_fewo' => 'bool',
'is_calendar_hrs' => 'bool', 'is_calendar_hrs' => 'bool',
'is_calendar_stern_tours' => 'bool', 'is_calendar_stern_tours' => 'bool',
'status' => 'int', 'status' => 'int',
@ -187,6 +188,7 @@ class TravelUserBookingFewo extends Model
'travel_booking_fewo_channel_id', 'travel_booking_fewo_channel_id',
'notice', 'notice',
'is_calendar_fewo_direct', 'is_calendar_fewo_direct',
'is_calendar_traum_fewo',
'is_calendar_hrs', 'is_calendar_hrs',
'is_calendar_stern_tours', 'is_calendar_stern_tours',
'status', 'status',
@ -268,6 +270,7 @@ class TravelUserBookingFewo extends Model
public function getCheckedBadgeCalendar(){ public function getCheckedBadgeCalendar(){
$back = ""; $back = "";
$back .= $this->is_calendar_fewo_direct ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>'; $back .= $this->is_calendar_fewo_direct ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
$back .= $this->is_calendar_traum_fewo ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
$back .= $this->is_calendar_hrs ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>'; $back .= $this->is_calendar_hrs ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
$back .= $this->is_calendar_stern_tours ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>'; $back .= $this->is_calendar_stern_tours ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : ' <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
return $back; return $back;
@ -544,6 +547,14 @@ class TravelUserBookingFewo extends Model
return $path.$dir; return $path.$dir;
} }
public function getInvoiceDir(){
$dir = $this->getBookingDateYear()."/";
if(!Storage::disk('fewo_invoices')->exists( $dir )){
Storage::disk('fewo_invoices')->makeDirectory($dir); //creates directory
}
return $dir;
}
public function isInvoice(){ public function isInvoice(){
if($this->invoice_number){ if($this->invoice_number){
$dir = $this->getBookingDateYear()."/"; $dir = $this->getBookingDateYear()."/";
@ -612,6 +623,14 @@ class TravelUserBookingFewo extends Model
return $path.$dir; return $path.$dir;
} }
public function getTravelInfoDir(){
$dir = $this->getBookingDateYear()."/";
if(!Storage::disk('fewo_infos')->exists( $dir )){
Storage::disk('fewo_infos')->makeDirectory($dir); //creates directory
}
return $dir;
}
public function isTravelInfo(){ public function isTravelInfo(){
if($this->invoice_number){ if($this->invoice_number){
$dir = $this->getBookingDateYear()."/"; $dir = $this->getBookingDateYear()."/";

View file

@ -0,0 +1,314 @@
<?php
namespace App\Repositories;
use stdClass;
use App\Models\Coupon;
use App\Models\Booking;
use App\Libraries\CreatePDF;
use App\Models\BookingStorno;
use App\Libraries\MyPDFMerger;
use App\Models\BookingDocument;
use App\Libraries\CreatePDFCoupon;
use Carbon;
use Illuminate\Support\Facades\Storage;
class BookingPDFRepository extends BaseRepository {
protected $prepath;
public function __construct(Booking $model)
{
$this->model = $model;
$this->prepath = Storage::disk('public')->getAdapter()->getPathPrefix();
}
public function update($data)
{
return $this->model;
}
public function createPDF($id, $data){
$this->model = Booking::findOrFail($id);
switch ($data['action']) {
case 'createPDF_Registration':
return $this->createPDF_Registration();
break;
case 'createPDF_Confirmation':
return $this->createPDF_Confirmation();
break;
case 'createPDF_Coupon':
return $this->createPDF_Coupon($data);
break;
case 'createPDF_Voucher':
$this->createPDF_Voucher(false); //client
return $this->createPDF_Voucher(true); //acency
break;
case 'createPDF_VoucherAgency':
return $this->createPDF_Voucher(true);
break;
case 'createPDF_Storno':
return $this->createPDF_Storno($data);
break;
}
}
public function createPDF_Registration(){
$document = new stdClass();
$document->name = 'registration';
$document->number = $this->model->lead_id;
$document->title = 'BUCHUNGSAUFTRAG';
$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,
'document' => $document,
];
$pdf_file->create($data, $filename, 'save', $this->prepath.$dir);
$booking_document = $this->savePDF($dir, $filename, 'sterntours-template', 'registration', $document);
return $booking_document;
}
public function createPDF_Confirmation(){
$document = new stdClass();
$document->name = 'confirmation';
$document->number = $this->model->lead_id;
$document->title = 'REISEBESTÄTIGUNG';
$document->voucher = null;
$document->date = now();
$document->total = $this->model->getPriceRaw();
$document->deposit = $this->model->getConfirmationDeposit();
$document->final_payment = $this->model->getConfirmationFinalPayment();
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 {
$document->final_payment_date = date('Y-m-d');
}
$dir = $this->getDirPath('pdf', 'booking', $document->date->format('Y'));
$filename = "Reisebestätigung-".$this->model->lead_id.".pdf";
$pdf_file = new CreatePDF('pdf.booking_confirmation');
$data = [
'booking' => $this->model,
'document' => $document,
];
$pdf_file->create($data, $filename, 'save', $this->prepath.$dir);
$booking_document = $this->savePDF($dir, $filename, 'sterntours-template', 'confirmation', $document);
return $booking_document;
}
public function createPDF_Coupon($data){
$document = new stdClass();
$document->name = 'coupon';
$document->title = 'COUPON';
$document->voucher = null;
$document->date = now();
$coupon = new Coupon();
$coupon->booking_id = $this->model->id;
$coupon->customer_id = $this->model->customer->id;
$coupon->value = $data['value'];
$coupon->issue_date = $data['issue_date'];
$coupon->valid_date = $data['valid_date'];
$coupon->is_redeemed = false;
$coupon->save();
$document->number = $coupon->number;
$document->value = $coupon->value;
$document->issue_date = $coupon->issue_date;
$document->valid_date = $coupon->valid_date;
$document->coupon_id = $coupon->id;
$dir = $this->getDirPath('pdf', 'coupon', $document->date->format('Y'));
$filename = "Gutschein-".$coupon->number.".pdf";
$pdf_file = new CreatePDFCoupon('pdf.booking_coupon');
$data = [
'booking' => $this->model,
'document' => $document,
'coupon' => $coupon,
];
$pdf_file->create($data, $filename, 'save', $this->prepath.$dir);
$booking_document = $this->savePDF($dir, $filename, 'sterntours-coupon', 'coupon', $document);
return $booking_document;
}
public function createPDF_Voucher($agency = false){
$document = new stdClass();
$document->name = 'voucher';
$document->number = $this->model->lead_id;
$document->name = 'voucher';
$document->title = $agency ? 'VOUCHER Agentur': 'VOUCHER';
$document->voucher = $agency ? 'agency': 'client';
$document->date = now();
$dir = $this->getDirPath('pdf', 'voucher', $document->date->format('Y'));
$filename = ($agency ? 'VoucherAgentur': 'Voucher')."-".$this->model->lead_id.".pdf";
$pdf_file = new CreatePDF('pdf.booking_voucher');
$data = [
'booking' => $this->model,
'document' => $document,
];
$pdf_file->create($data, $filename, 'save', $this->prepath.$dir);
$identifier = $agency ? 'voucher_agency': 'voucher';
$booking_document = $this->savePDF($dir, $filename, 'sterntours-template', $identifier, $document);
return $booking_document;
}
public function createPDF_Storno($data){
//Storno Values
$storno_status_id = (int) $data['storno_status_id'];
$storno_level = (float) $data['storno_level'];
$storno_level_number = \Util::_clean_float($data['storno_level_number']);
$storno_total_price = \Util::_clean_float($data['storno_total_price']);
$price = $this->model->getPriceRaw();
if($storno_level_number > 0 && $storno_level_number < 100 ){
$storno_level = $storno_level_number;
}
//calculate price canceled
if($storno_total_price > 0){
$price_canceled = $storno_total_price;
$storno_level = ((100 / $price) * $storno_total_price);
}else{
$price_canceled = round($price / 100 * $storno_level, 2);
}
//init identifier
$identifier = 'storno';
//create / update BookingStorno
$fill = [
'booking_id' => $this->model->id,
'total' => $price,
'storno' => $price_canceled,
'storno_date' => $data['storno_date'],
'storno_print' => $data['storno_print']
];
if($this->model->hasDocument($identifier)){
$booking_document = $this->model->getDocument($identifier);
$booking_storno = $booking_document->booking_storno;
$booking_storno->update($fill);
}else{
$booking_storno = BookingStorno::create($fill);
}
//init document
$document = new stdClass();
$document->name = $identifier;
$document->number = $this->model->lead_id;
$document->title = 'STORNOBESTÄTIGUNG';
$document->voucher = null;
$document->date = Carbon::parse($data['storno_print']);
$document->total = $price;
$document->storno = $price_canceled;
$document->storno_date = $data['storno_date'];
$document->storno_print = $data['storno_print'];
$document->storno_status_id = $storno_status_id;
$document->booking_storno_id = $booking_storno->id;
$document->storno_level = $storno_level;
//update Booking // Lead Status
if($storno_status_id){
$this->model->lead->status_id = $storno_status_id;
$this->model->lead->save();
}
$this->model->canceled = $storno_level;
$this->model->price_canceled = $price_canceled; //must pay
$this->model->price_total = $price_canceled; //is the same as Canceled( ...
$this->model->price_balance = round($price - $price_canceled, 2); //is the Rest - must not pay
$this->model->save();
$dir = $this->getDirPath('pdf', 'storno', $document->date->format('Y'));
$filename = "Reisestornierung -".$this->model->lead_id.".pdf";
$pdf_file = new CreatePDF('pdf.booking_storno');
$data = [
'booking' => $this->model,
'document' => $document,
];
$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){
$path = $file.'/'.$dir.'/'.$year.'/';
if(!Storage::disk('public')->exists( $path )){
Storage::disk('public')->makeDirectory($path); //creates directory
}
return $path;
}
private function savePDF($dir, $filename, $template, $identifier, $document = null, $status = 0){
$pdfMerger = new MyPDFMerger();
$pdfMerger->addPDF($this->prepath.$dir.$filename);
$file = $pdfMerger->myMerge('string', $filename, $template);
Storage::disk('public')->put($dir.$filename, $file);
$fill = [
'booking_id' => $this->model->id,
'customer_id' => $this->model->customer_id,
'lead_id' => $this->model->lead_id,
'identifier' => $identifier,
'filename' => $filename,
'dir' => $dir,
'original_name' => $filename,
'ext' => 'pdf',
'mine' => 'application/pdf',
'size' => Storage::disk('public')->size($dir.$filename),
'date' => now(),
'data' => $document,
'status' => $status,
'booking_storno_id' => isset($document->booking_storno_id) ? $document->booking_storno_id : null,
'coupon_id' => isset($document->coupon_id) ? $document->coupon_id : null,
];
if($this->model->hasDocument($identifier)){
$booking_document = $this->model->getDocument($identifier);
$booking_document->update($fill);
}else{
$booking_document = BookingDocument::create($fill);
}
return $booking_document;
//return $pdfMerger->myMerge('browser', $filename, $template);
}
}

View file

@ -87,7 +87,8 @@ class BookingRepository extends BaseRepository {
'travel_documents' => $data['travel_documents'], 'travel_documents' => $data['travel_documents'],
'paying_out' => $data['paying_out'], 'paying_out' => $data['paying_out'],
'paying_out_status' => $data['paying_out_status'], 'paying_out_status' => $data['paying_out_status'],
'branch_id' => $data['branch_id'], 'branch_id' => isset($data['branch_id']) ? $data['branch_id'] : 4,
'airport_id' => (isset($data['airport_id']) && $data['airport_id']>0) ? $data['airport_id'] : null,
'travel_company_id' => $data['travel_company_id'], 'travel_company_id' => $data['travel_company_id'],
//'airline_id' => $data['airline_id'], //'airline_id' => $data['airline_id'],
'airline_ids' => isset($data['airline_ids']) ? $data['airline_ids'] : null, 'airline_ids' => isset($data['airline_ids']) ? $data['airline_ids'] : null,
@ -227,7 +228,10 @@ class BookingRepository extends BaseRepository {
$this->model->nationality_id = isset($data['nationality_id']) ? $data['nationality_id'] : null; $this->model->nationality_id = isset($data['nationality_id']) ? $data['nationality_id'] : null;
$this->model->participant_birthdate = isset($data['participant_birthdate']) ? _reformat_date($data['participant_birthdate']) : null; $this->model->participant_birthdate = isset($data['participant_birthdate']) ? _reformat_date($data['participant_birthdate']) : null;
$this->model->participant_pass = isset($data['participant_pass']) ? true : false; $this->model->participant_pass = isset($data['participant_pass']) ? true : false;
//update pax
if($this->model->participants->count() > 0){
$this->model->pax = $this->model->participants->where('participant_storno', false)->count();
}
$this->model->save(); $this->model->save();
return $this->model; return $this->model;
} }

View file

@ -3,8 +3,9 @@
namespace App\Repositories; namespace App\Repositories;
use App\Models\Customer;
use App\Models\Lead; use App\Models\Lead;
use App\Models\Booking;
use App\Models\Customer;
class CustomerRepository extends BaseRepository { class CustomerRepository extends BaseRepository {
@ -22,7 +23,7 @@ class CustomerRepository extends BaseRepository {
return $this->model; return $this->model;
} }
//by Lead ID
public function updateCustomerFromLead($id, $data){ public function updateCustomerFromLead($id, $data){
$lead = Lead::findOrFail($id); $lead = Lead::findOrFail($id);
@ -30,5 +31,14 @@ class CustomerRepository extends BaseRepository {
return $this->updateCustomer($lead->customer->id, $data['customer']); return $this->updateCustomer($lead->customer->id, $data['customer']);
} }
} }
//by Booking ID
public function updateCustomerFromBooking($id, $data){
$booking = Booking::findOrFail($id);
if(isset($data['customer']) && $booking->customer){
return $this->updateCustomer($booking->customer->id, $data['customer']);
}
}
} }

View file

@ -125,6 +125,7 @@ class FileRepository extends BaseRepository {
} }
return false; return false;
} }
private function makeFilename(){ private function makeFilename(){
$originalNameWithoutExt = substr($this->originalName, 0, strlen($this->originalName) - strlen($this->extension) - 1); $originalNameWithoutExt = substr($this->originalName, 0, strlen($this->originalName) - strlen($this->extension) - 1);
$this->filename = Util::sanitize($originalNameWithoutExt, true, false, true); $this->filename = Util::sanitize($originalNameWithoutExt, true, false, true);

View file

@ -117,7 +117,9 @@ class LeadRepository extends BaseRepository {
$this->model->participant_firstname = isset($data['participant_firstname']) ? $data['participant_firstname'] : null; $this->model->participant_firstname = isset($data['participant_firstname']) ? $data['participant_firstname'] : null;
//$this->model->nationality_id = isset($data['nationality_id']) ? $data['nationality_id'] : null; //$this->model->nationality_id = isset($data['nationality_id']) ? $data['nationality_id'] : null;
$this->model->participant_birthdate = isset($data['participant_birthdate']) ? _reformat_date($data['participant_birthdate']) : null; $this->model->participant_birthdate = isset($data['participant_birthdate']) ? _reformat_date($data['participant_birthdate']) : null;
/*if($this->model->lead_participants->count() > 0){
$this->model->pax = $this->model->lead_participants->count();
}*/
$this->model->save(); $this->model->save();
return $this->model; return $this->model;
} }

View file

@ -73,7 +73,7 @@ class TravelProgramRepository extends BaseRepository {
'discount_is_percent_value' => $data['discount_is_percent_value'] ? $data['discount_is_percent_value'] : null, 'discount_is_percent_value' => $data['discount_is_percent_value'] ? $data['discount_is_percent_value'] : null,
'travel_arrival_point_id' => $data['travel_arrival_point_id'] ? $data['travel_arrival_point_id'] : null, 'travel_arrival_point_id' => $data['travel_arrival_point_id'] ? $data['travel_arrival_point_id'] : null,
'max_age_for_children' => $data['max_age_for_children'] ? $data['max_age_for_children'] : null, 'max_age_for_children' => $data['max_age_for_children'] ? $data['max_age_for_children'] : null,
'url' => $data['url'] ? $data['url'] : null, //'url' => $data['url'] ? $data['url'] : null,
'generalnote' => $data['generalnote'] ? $data['generalnote'] : null, 'generalnote' => $data['generalnote'] ? $data['generalnote'] : null,
'payment_conditions' => $data['payment_conditions'] ? $data['payment_conditions'] : null, 'payment_conditions' => $data['payment_conditions'] ? $data['payment_conditions'] : null,
]; ];
@ -83,6 +83,24 @@ class TravelProgramRepository extends BaseRepository {
} }
public function updatePage($id, $data){
//weekdays
$this->model = TravelProgram::findOrFail($id);
if(!$this->model->page){
return $this->model;
}
$fill = [
'title' => $data['page_title'] ? $data['page_title'] : null,
'pagetitle' => $data['page_pagetitle'] ? $data['page_pagetitle'] : null,
'description' => $data['page_description'] ? $data['page_description'] : null,
'slug' => $data['page_slug'] ? $data['page_slug'] : null,
];
$this->model->page->fill($fill);
$this->model->page->save();
return $this->model;
}
/* /*
'profit_margin', 'profit_margin',

View file

@ -4,20 +4,21 @@ namespace App\Repositories;
use App\Models\FewoPrice;
use App\Models\FewoReservation;
use App\Models\FewoSeason;
use App\Models\TravelClass;
use App\Models\TravelProgram;
use App\Models\TravelProgramDraft;
use App\Models\TravelUserBookingFewo;
use App\Models\TravelUserBookingFewoNotice;
use App\Services\Util;
use PDF; use PDF;
use Carbon\Carbon;
use Request; use Request;
use Storage; use Storage;
use Validator; use Validator;
use Carbon\Carbon;
use App\Services\Util;
use App\Models\FewoPrice;
use App\Models\FewoSeason;
use App\Models\TravelClass;
use App\Libraries\CreatePDF;
use App\Models\TravelProgram;
use App\Models\FewoReservation;
use App\Models\TravelProgramDraft;
use App\Models\TravelUserBookingFewo;
use App\Models\TravelUserBookingFewoNotice;
class TravelUserBookingFewoRepository extends BaseRepository { class TravelUserBookingFewoRepository extends BaseRepository {
@ -51,7 +52,7 @@ class TravelUserBookingFewoRepository extends BaseRepository {
public function createTravelInfoPDF($id, $travel_info_user_text){ public function createTravelInfoPDF($id, $travel_info_user_text){
$model = TravelUserBookingFewo::findOrFail($id); $model = TravelUserBookingFewo::findOrFail($id);
$travel_info_user_text = str_replace("", "&euro;", $travel_info_user_text);
$model->info_mail_text = $travel_info_user_text; $model->info_mail_text = $travel_info_user_text;
$model->save(); $model->save();
@ -59,15 +60,14 @@ class TravelUserBookingFewoRepository extends BaseRepository {
'model' => $model, 'model' => $model,
'travel_info_user_text' => $travel_info_user_text, 'travel_info_user_text' => $travel_info_user_text,
]; ];
$pdf = PDF::loadView('pdf.travel_info_fewo', $data);
$pdf->setPaper('A4', 'portrait');
$path =$model->getTravelInfoPath(); $path =$model->getTravelInfoPath();
$dir = $model->getTravelInfoDir();
$filename = $model->getTravelInfoFileName(); $filename = $model->getTravelInfoFileName();
$pdf->save($path.$filename); $pdf_file = new CreatePDF('pdf.travel_info_fewo', 'fewo_infos');
$pdf_file->create($data, $filename, 'save', $path);
$pdf_file->merger($dir, $filename, 'sterntours-template-logo');
return $path.$filename; return $path.$filename;
//return $pdf->stream('invoice.pdf');
} }
public function createInvoicePDF($id){ public function createInvoicePDF($id){
@ -76,13 +76,14 @@ class TravelUserBookingFewoRepository extends BaseRepository {
$data = [ $data = [
'model' => $model, 'model' => $model,
]; ];
$pdf = PDF::loadView('pdf.invoice_fewo', $data);
$pdf->setPaper('A4', 'portrait');
$path =$model->getInvoicePath(); $path =$model->getInvoicePath();
$dir = $model->getInvoiceDir();
$filename = $model->getInvoiceFileName(); $filename = $model->getInvoiceFileName();
$pdf->save($path.$filename); $pdf_file = new CreatePDF('pdf.invoice_fewo', 'fewo_invoices');
$pdf_file->create($data, $filename, 'save', $path);
$pdf_file->merger($dir, $filename, 'sterntours-template-logo');
return $path.$filename; return $path.$filename;
//return $pdf->stream('invoice.pdf');
} }
public function check($id,$data) public function check($id,$data)
{ {
@ -210,6 +211,7 @@ class TravelUserBookingFewoRepository extends BaseRepository {
} }
$data['is_calendar_fewo_direct'] = isset($data['is_calendar_fewo_direct']) ? true : false; $data['is_calendar_fewo_direct'] = isset($data['is_calendar_fewo_direct']) ? true : false;
$data['is_calendar_traum_fewo'] = isset($data['is_calendar_traum_fewo']) ? true : false;
$data['is_calendar_hrs'] = isset($data['is_calendar_hrs']) ? true : false; $data['is_calendar_hrs'] = isset($data['is_calendar_hrs']) ? true : false;
$data['is_calendar_stern_tours'] = isset($data['is_calendar_stern_tours']) ? true : false; $data['is_calendar_stern_tours'] = isset($data['is_calendar_stern_tours']) ? true : false;

View file

@ -0,0 +1,47 @@
<?php
namespace App\Services;
use App\Libraries\CouponPDF;
use App\Models\Coupon;
use Storage;
class CreatePDFCoupon{
protected $view;
protected $pdf;
public function __construct($view)
{
$this->view = $view;
}
public function create($data, $name='test.pdf', $output='stream', $path = false){
header('Content-type: text/html; charset=UTF-8') ;//chrome
//dd($data);
$pdf = app('dompdf.wrapper');
$pdf->getDomPDF()->set_option("enable_php", true);
$pdf->loadView($this->view, $data);
$customPaper = array(0, 0, 595.28, 283,47);
$pdf->setPaper($customPaper, 'portrait');
// $pdf->setPaper('A4', 'portrait');
if($output === 'stream'){
return $pdf->stream($name);
}
if($output === 'download'){
return $pdf->download($name);
}
if($output === 'save'){
if($path){
$pdf->save($path.$name);
return $path.$name;
}
}
}
}
?>

View file

@ -1,6 +1,7 @@
<?php <?php
namespace App\Services; namespace App\Services;
use App\Models\Airport;
use App\Models\Branch; use App\Models\Branch;
use App\Models\Status; use App\Models\Status;
use App\Models\DraftType; use App\Models\DraftType;
@ -68,6 +69,12 @@ class Model
$TravelCompany = TravelCompany::where('active', true)->orderBy('name')->get()->pluck('name', 'id'); $TravelCompany = TravelCompany::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
return $emtpy ? $TravelCompany->prepend('-', 0) : $TravelCompany; return $emtpy ? $TravelCompany->prepend('-', 0) : $TravelCompany;
} }
public static function getAirportArray($emtpy = false){
$Airports = Airport::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
return $emtpy ? $Airports->prepend('-', 0) : $Airports;
}
public static function getTravelArrivalPointArray($emtpy = false){ public static function getTravelArrivalPointArray($emtpy = false){
$TravelArrivalPoint = TravelArrivalPoint::where('active', true)->orderBy('name')->get()->pluck('name', 'id'); $TravelArrivalPoint = TravelArrivalPoint::where('active', true)->orderBy('name')->get()->pluck('name', 'id');

View file

@ -0,0 +1,188 @@
<?php
namespace App\Services;
//use FPDI in myMerge v2
//use FPDF;
//use FPDI;
class MyPDFMerger
{
private $_files; //['form.pdf'] ["1,2,4, 5-19"]
private $_fpdi;
public function __construct()
{
/* if(!class_exists("FPDF")) {
require_once(__DIR__.'/fpdf/fpdf.php');
}
if(!class_exists("FPDI")) {
require_once(__DIR__.'/fpdi/fpdi.php');
}*/
}
public function addPDF($filepath, $pages = 'all')
{
if (file_exists($filepath)) {
if (strtolower($pages) != 'all') {
$pages = $this->_rewritepages($pages);
}
$this->_files[] = array($filepath, $pages);
} else {
throw new \exception("Could not locate PDF on '$filepath'");
}
return $this;
}
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;
$fpdi = new \setasign\Fpdi\Fpdi();
$first = 1;
//
//merger operations
foreach ($this->_files as $file) {
$filename = $file[0];
$filepages = $file[1];
$count = $fpdi->setSourceFile($filename);
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$count = $fpdi->setSourceFile($filename);
$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');
if($first == 1){
$first = 2;
}
$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;
$size = $fpdi->getTemplateSize($template);
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
if($theme){
$fpdi->setSourceFile(__DIR__ . '/../../public/pdf/'.$theme.'-'.$first.'.pdf');
if($first == 1){
$first = 2;
}
$backId = $fpdi->importPage(1);
$fpdi->useTemplate($backId);
}
$fpdi->useTemplate($template);
}
}
//after first file (invoice) on bpaper
$slug = false;
}
//output operations
$mode = $this->_switchmode($outputmode);
if ($mode == 'S') {
return $fpdi->Output($outputpath, 'S');
} else {
if ($fpdi->Output($outputpath, $mode) == '') {
return true;
} else {
throw new \exception("Error outputting PDF to '$outputmode'.");
return false;
}
}
}
/**
* FPDI uses single characters for specifying the output location. Change our more descriptive string into proper format.
* @param $mode
* @return Character
*/
private function _switchmode($mode)
{
switch (strtolower($mode)) {
case 'download':
return 'D';
break;
case 'browser':
return 'I';
break;
case 'file':
return 'F';
break;
case 'string':
return 'S';
break;
default:
return 'I';
break;
}
}
/**
* Takes our provided pages in the form of 1,3,4,16-50 and creates an array of all pages
* @param $pages
* @return array
* @throws exception
*/
private function _rewritepages($pages)
{
$pages = str_replace(' ', '', $pages);
$part = explode(',', $pages);
//parse hyphens
foreach ($part as $i) {
$ind = explode('-', $i);
if (count($ind) == 2) {
$x = $ind[0]; //start page
$y = $ind[1]; //end page
if ($x > $y): throw new \exception("Starting page, '$x' is greater than ending page '$y'.");
return false; endif;
//add middle pages
while ($x <= $y): $newpages[] = (int)$x;
$x++; endwhile;
} else {
$newpages[] = (int)$ind[0];
}
}
return $newpages;
}
}
/*
$pdf = new PDFMerger;
$pdf->addPDF('samplepdfs/one.pdf', '1, 3, 4')
->addPDF('samplepdfs/two.pdf', '1-2')
->addPDF('samplepdfs/three.pdf', 'all')
->merge('file', 'samplepdfs/TEST2.pdf');
//REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options
//You do not need to give a file path for browser, string, or download - just the name.
*/

View file

@ -1,8 +1,9 @@
<?php <?php
namespace App\Services; namespace App\Services;
use GuzzleHttp\Client;
use Storage; use Storage;
use GuzzleHttp\Client;
use App\Libraries\CreatePDF;
class Passolution class Passolution
{ {
@ -167,6 +168,7 @@ class Passolution
public function onlyCreatePDF(){ public function onlyCreatePDF(){
$pdf_file = new CreatePDF('pdf.passolution'); $pdf_file = new CreatePDF('pdf.passolution');
$pdf_file->create(['contents' => $this->htmlText], $this->pdf_name, 'save', $this->pdf_path.$this->pdf_dir); $pdf_file->create(['contents' => $this->htmlText], $this->pdf_name, 'save', $this->pdf_path.$this->pdf_dir);
$pdf_file->merger($this->pdf_dir, $this->pdf_name, 'sterntours-template');
} }
public function findOrCreatePDF($create = false, $resync = false){ public function findOrCreatePDF($create = false, $resync = false){

View file

@ -4,6 +4,16 @@ namespace App\Services;
class Util class Util
{ {
public static function isTestSystem($dev = false){
if(\Config::get('app.domain_tld') === 'test'){
if($dev && config('app.debug') !== true){
return false;
}
return true;
}
return false;
}
public static function formatDate(){ public static function formatDate(){
if(\App::getLocale() == "en"){ if(\App::getLocale() == "en"){
return 'yyyy-mm-dd'; return 'yyyy-mm-dd';
@ -65,6 +75,7 @@ class Util
} }
return null; return null;
} }
public static function _implodeLines($value, $glue=PHP_EOL){ public static function _implodeLines($value, $glue=PHP_EOL){
if(is_array($value)){ if(is_array($value)){
return implode($glue, $value); return implode($glue, $value);
@ -235,6 +246,19 @@ class Util
return $html; return $html;
} }
public static function prepareCollapseValues(){
if(\Session::has('collapse_shows')){
$collapse_shows = \Session::get('collapse_shows');
if(strpos($collapse_shows, ',')){
$collapse_shows = explode(',', $collapse_shows);
return json_encode($collapse_shows);
}
return json_encode([0 => $collapse_shows]);
}
return json_encode([0 => 'non']);
}
public static function convertArrayWindowsCharset($values){ public static function convertArrayWindowsCharset($values){
foreach ($values as $key=>$string){ foreach ($values as $key=>$string){
$values[$key] = self::convertStringWindowsCharset($string); $values[$key] = self::convertStringWindowsCharset($string);

View file

@ -24,6 +24,13 @@ if (! function_exists('_format_date')) {
} }
} }
if (! function_exists('_number_format')) {
function _number_format($number, $dec = 2)
{
return $number ? \App\Services\Util::_number_format($number, $dec) : null;
}
}
if (! function_exists('_reformat_date')) { if (! function_exists('_reformat_date')) {
function _reformat_date($date, $to = 'date') function _reformat_date($date, $to = 'date')
{ {

View file

@ -60,7 +60,7 @@ return [
'url_stern' => env('APP_URL_STERN', 'https://www.sterntours.de'), 'url_stern' => env('APP_URL_STERN', 'https://www.sterntours.de'),
'domain_tld' => env('APP_DOMAIN_TLD', 'test'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -236,7 +236,7 @@ return [
'Image' => Intervention\Image\Facades\Image::class, 'Image' => Intervention\Image\Facades\Image::class,
'Carbon' => Carbon\Carbon::class, 'Carbon' => Carbon\Carbon::class,
'Date' => Jenssegers\Date\Date::class, 'Date' => Jenssegers\Date\Date::class,
'HTMLHelper' => App\Services\HTMLHelper::class, 'HTMLHelper' => App\Helper\HTMLHelper::class,
'Util' => App\Services\Util::class, 'Util' => App\Services\Util::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'DataTables' => Yajra\DataTables\Facades\DataTables::class, 'DataTables' => Yajra\DataTables\Facades\DataTables::class,

View file

@ -4,5 +4,10 @@ return [
'identifier_general' => 'booking-pdf-g-', 'identifier_general' => 'booking-pdf-g-',
'identifier_general_name' => 'booking-pdf-general-name', 'identifier_general_name' => 'booking-pdf-general-name',
'identifier_content' => 'booking-pdf-c-', 'identifier_content' => 'booking-pdf-c-',
'identifier_content_name' => 'booking-pdf-content-name' 'identifier_content_name' => 'booking-pdf-content-name',
'max_interval_days' => 28,
'deposit_percentage_rate' => 25,
'max_deposit_interval_days' => 28,
'coupon_default_value' => '50,00',
'coupon_valid_date_month' => 24,
]; ];

View file

@ -232,7 +232,7 @@ return array(
/** /**
* A ratio applied to the fonts height to be more like browsers' line height * A ratio applied to the fonts height to be more like browsers' line height
*/ */
"font_height_ratio" => 1.1, "font_height_ratio" => 0.8,
/** /**
* Use the more-than-experimental HTML5 Lib parser * Use the more-than-experimental HTML5 Lib parser

View file

@ -46,6 +46,7 @@ return [
'sua-fewo-n-edit' => ['name' => 'SUPERADMIN > FeWo > Notizen > bearbeiten' , 'color' => 'secondary'], 'sua-fewo-n-edit' => ['name' => 'SUPERADMIN > FeWo > Notizen > bearbeiten' , 'color' => 'secondary'],
'sua-st' => ['name' => 'SUPERADMIN > Einstellungen' , 'color' => 'superadmin'], 'sua-st' => ['name' => 'SUPERADMIN > Einstellungen' , 'color' => 'superadmin'],
'sua-st-al' => ['name' => 'SUPERADMIN > Einstellungen > Airline' , 'color' => 'superadmin'], 'sua-st-al' => ['name' => 'SUPERADMIN > Einstellungen > Airline' , 'color' => 'superadmin'],
'sua-st-ap' => ['name' => 'SUPERADMIN > Einstellungen > Airport' , 'color' => 'superadmin'],
'sua-st-em' => ['name' => 'SUPERADMIN > Einstellungen > E-Mails' , 'color' => 'superadmin'], 'sua-st-em' => ['name' => 'SUPERADMIN > Einstellungen > E-Mails' , 'color' => 'superadmin'],
'sua-st-ke' => ['name' => 'SUPERADMIN > Einstellungen > Keywords' , 'color' => 'superadmin'], 'sua-st-ke' => ['name' => 'SUPERADMIN > Einstellungen > Keywords' , 'color' => 'superadmin'],
'sua-st-sp' => ['name' => 'SUPERADMIN > Einstellungen > Leistungsträger' , 'color' => 'superadmin'], 'sua-st-sp' => ['name' => 'SUPERADMIN > Einstellungen > Leistungsträger' , 'color' => 'superadmin'],
@ -63,8 +64,9 @@ return [
'sua-re' => ['name' => 'SUPERADMIN > Export' , 'color' => 'superadmin'], 'sua-re' => ['name' => 'SUPERADMIN > Export' , 'color' => 'superadmin'],
'sua-re-bo' => ['name' => 'SUPERADMIN > Export > Buchungen' , 'color' => 'superadmin'], 'sua-re-bo' => ['name' => 'SUPERADMIN > Export > Buchungen' , 'color' => 'superadmin'],
'sua-re-pp' => ['name' => 'SUPERADMIN > Export > Leistungsträger' , 'color' => 'superadmin'], 'sua-re-pp' => ['name' => 'SUPERADMIN > Export > Leistungsträger' , 'color' => 'superadmin'],
'sua-re-fw' => ['name' => 'SUPERADMIN > Export > Fewo' , 'color' => 'superadmin'],
'sua-re-le' => ['name' => 'SUPERADMIN > Export > Anfragen' , 'color' => 'superadmin'],
'sua-ur-rt' => ['name' => 'SUPERADMIN > User Rechte' , 'color' => 'danger'], 'sua-ur-rt' => ['name' => 'SUPERADMIN > User Rechte' , 'color' => 'danger'],
'cms-cn-co' => ['name' => 'ADMIN CMS > Inhalte > Länder' , 'color' => 'secondary'], 'cms-cn-co' => ['name' => 'ADMIN CMS > Inhalte > Länder' , 'color' => 'secondary'],
], ],
], ],

View file

@ -46,6 +46,7 @@ class CreateTravelUserBookingFewosTable extends Migration
$table->text('notice')->nullable(); $table->text('notice')->nullable();
$table->boolean('is_calendar_traum_fewo')->default(false); // Fewo-Direkt, HRS und STERN TOUR
$table->boolean('is_calendar_fewo_direct')->default(false); // Fewo-Direkt, HRS und STERN TOUR $table->boolean('is_calendar_fewo_direct')->default(false); // Fewo-Direkt, HRS und STERN TOUR
$table->boolean('is_calendar_hrs')->default(false); $table->boolean('is_calendar_hrs')->default(false);
$table->boolean('is_calendar_stern_tours')->default(false); $table->boolean('is_calendar_stern_tours')->default(false);

View file

@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBookingDocumentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('booking_documents', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('booking_id')->nullable();
$table->bigInteger('customer_id')->nullable();
$table->bigInteger('lead_id')->nullable();
$table->bigInteger('coupon_id')->nullable();
$table->bigInteger('booking_storno_id')->nullable();
$table->string('identifier')->index();
$table->string('filename');
$table->string('dir');
$table->string('original_name');
$table->string('ext');
$table->string('mine');
$table->unsignedInteger('size');
$table->date('date');
$table->text('data')->nullable();
$table->unsignedTinyInteger('status')->nullable()->default(0);
$table->timestamps();
$table->foreign('booking_id')
->references('id')
->on('booking');
$table->foreign('customer_id')
->references('id')
->on('customer');
$table->foreign('lead_id')
->references('id')
->on('lead');
$table->foreign('coupon_id')
->references('id')
->on('coupon');
$table->foreign('booking_storno_id')
->references('id')
->on('booking_storno');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('booking_documents');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAirportTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('airports', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('code', 10);
$table->string('name', 255);
$table->string('city', 255)->nullable();
$table->string('country', 255)->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('airports');
}
}

View file

@ -283,7 +283,6 @@ class Lfm
$middleware = [ CreateDefaultFolder::class, MultiUser::class ]; $middleware = [ CreateDefaultFolder::class, MultiUser::class ];
$as = 'iqcontent.lfm.'; $as = 'iqcontent.lfm.';
$namespace = '\\IqContent\\LaravelFilemanager\\Controllers\\'; $namespace = '\\IqContent\\LaravelFilemanager\\Controllers\\';
Route::group(compact('middleware', 'as', 'namespace'), function () { Route::group(compact('middleware', 'as', 'namespace'), function () {
// display main layout // display main layout

View file

@ -22,6 +22,9 @@
RewriteCond %{HTTP:Authorization} . RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder... # Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$ RewriteCond %{REQUEST_URI} (.+)/$

View file

@ -0,0 +1,557 @@
@media (max-width: 767px) {
.table-responsive .dropdown-menu,
.table-responsive .dropdown-toggle {
position: static !important;
}
}
@media (min-width: 768px) {
.table-responsive {
overflow: visible;
}
}
.table-responsive {
overflow: auto;
overflow-y: visible;
}
.custom-select.active {
border-color: #a8c1a0;
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.custom-select.deactive {
border-color: #c1998f;
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.form-control.active {
border: 1px solid rgba(24, 28, 33, 0.1);
border-color: #a8c1a0;
}
.form-control.deactive {
border: 1px solid rgba(24, 28, 33, 0.1);
border-color: #c1998f;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-primary::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-primary::before {
border-color: #648859 !important;
background-color: #648859 !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-secondary::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-secondary::before {
border-color: #f2bf24 !important;
background-color: #f2bf24 !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-info::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-info::before {
border-color: #28c3d7 !important;
background-color: #28c3d7 !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-warning::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-warning::before {
border-color: #ff844d !important;
background-color: #ff844d !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-danger::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-danger::before {
border-color: #d9534f !important;
background-color: #d9534f !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-client::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-client::before {
border-color: #83878b !important;
background-color: #83878B !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-admin::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-admin::before {
border-color: #f2bf24 !important;
background-color: #f2bf24 !important;
}
.custom-control.custom-checkbox .custom-control-input:checked ~ .custom-control-label-superadmin::before,
.custom-control.custom-radio .custom-control-input:checked ~ .custom-control-label-superadmin::before {
border-color: #648859 !important;
background-color: #648859 !important;
}
.card hr.hr-primary {
border-color: rgba(100, 136, 89, 0.4);
}
.alert ul {
margin: 0;
}
/* Custom drag handle */
.dd-custom-drag-handle .dd-handle {
border: 0;
float: left;
margin: 1px;
font-size: 0.9rem;
line-height: 1.25rem;
}
.dd-custom-drag-handle .dd-handle>* {
vertical-align: middle;
}
[dir=rtl] .dd-custom-drag-handle .dd-handle {
float: right;
}
.dd-item > button:before {
content: '\f284';
}
.dd-item > button[data-action="collapse"]:before {
content: '\f280';
}
.dd-item > button {
display: inline-block;
font-size: 1.4rem;
text-transform: none;
font-weight: normal;
font-style: normal;
font-variant: normal;
font-family: "Ionicons";
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
speak: none;
text-rendering: auto
}
.btn.btn-light {
font-size: 0.9em;
}
.table thead th {
border-top: none;
}
.card-body {
padding: 1rem 1.5rem;
}
textarea.autoExpand{
box-sizing: border-box;
resize: none;
overflow: hidden;
}
.card {
border: 1px solid rgba(24, 28, 33, 0.20);
}
li div.dd-content-link {
overflow: hidden;
white-space: nowrap;
display: inline-block;
text-overflow: ellipsis;
max-width: 12rem;
}
li li div.dd-content-link {
max-width: 10rem;
}
li li li div.dd-content-link {
max-width: 8rem;
}
li li li li div.dd-content-link {
max-width: 6rem;
}
li li li li li div.dd-content-link {
max-width: 5rem;
}
.alert ul {
margin-bottom: 0;
}
.dragula-example {
margin-bottom: 6px;
border: 1px dotted #d6d6d6;
}
.sortable-example {
margin: 0;
padding: 0;
}
.sortable-example li {
padding: 6px 10px;
margin-bottom: 8px;
list-style: none;
}
.sortable-example-inline li {
margin-right: 8px;
display: inline-block;
}
[dir=rtl] .sortable-example-inline li {
margin-right: 0;
margin-left: 8px;
}
#sortable-3 {
width: 220px;
}
#sortable-3 img {
margin-right: 8px;
margin-bottom: 8px;
width: 100px;
height: 100px;
border-radius: 999px;
display: block;
float: left;
}
.card-header {
border-bottom: 1px solid rgba(115, 113, 150, 0.50);
}
.modal-header {
padding-bottom: 10px;
border-bottom: 1px solid rgba(115, 113, 150, 0.50);
}
.modal-footer {
padding-top: 10px;
border-top: 1px solid rgba(115, 113, 150, 0.50);
}
@media (min-width: 768px) {
.default-style .messages-sidebox.large {
-ms-flex-preferred-size: 23rem;
flex-basis: 23rem;
}
}
@media (min-width: 768px) {
.default-style .messages-sidebox {
-ms-flex-preferred-size: 19rem;
flex-basis: 19rem;
}
}
.switcher-on-off.switcher .switcher-input ~ .switcher-indicator {
background: #d9534f;
color: #fff;
}
.switcher-on-off.switcher .switcher-input:checked ~ .switcher-indicator {
background: #648859;
color: #fff;
}
.note-toolbar.card-header {
background-color: #f0f0f0;
}
@media (min-width: 992px){
.modal-xl {
max-width: 962px;
}
}
@media (min-width: 1200px){
.modal-xl {
max-width: 1170px;
}
}
figure {
border: 1px solid gainsboro;
display: inline-block;
}
figure p {
margin-bottom: 0.2rem;
}
figcaption {
display: block;
padding: 10px;
}
.figure-caption {
color: #595a5c;
}
.modal-xl.modal-dialog {
width: 98%;
height: 92%;
padding: 0;
}
.modal-xl .modal-content {
min-height: 99%;
}
.note-editor.note-frame.fullscreen, .note-editor.note-airframe.fullscreen {
z-index: 2040;
}
.video-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.mediaA, .imageWrapper {
width: 98%;
margin-left: .9%;
margin-right: .9%;
display: block;
}
/*.mediaA img .note-editable img {
float: left;
width: 100%;
}*/
.mediaA img, .imageWrapper img {
display: block;
width: 100%;
height: auto;
}
.mediaA .mediaInfo, .imageWrapper .mediaInfo {
width: 100%;
float: left;
background-color: #648859;
color: #fff;
margin-bottom: 1rem;
}
.mediaA .mediaInfo p {
padding: 4px 4px 4px 8px;
margin: 0;
width: auto;
}
.imageWrapper .mediaInfo p {
padding: 4px 4px 4px 8px;
margin: 0;
width: auto;
}
.note-editable h2 {
padding-bottom: 10px;
margin-bottom: 15px;
border-bottom: 1px solid #c2c2c2;
color: #616161;
display: block;
clear: both;
padding-top: 20px;
font-size: 24px;
font-weight: 400;
line-height: 1.1;
}
.modal-open .tooltip {
z-index: 2120;
}
.btn-next {
border-color: rgba(0, 0, 0, 0);
background: #8897AA;
color:#fff
}
.btn-next:hover {
border-color: rgba(0, 0, 0, 0);
background: #818fa2;
color:#fff
}
.btn-next:focus, .btn-next.focus {
box-shadow:0 0 0 2px rgba(136, 151, 170, 0.4)
}
.btn-next.disabled, .btn-next:disabled {
border-color: rgba(0, 0, 0, 0) !important;
background: #8897AA !important;
box-shadow: none !important;
color:#fff !important
}
.btn-next .badge {
background: #fff;
color:#8897AA
}
.btn-next:active, .btn-next.active, .show > .btn-next.dropdown-toggle {
border-color: rgba(0, 0, 0, 0);
background: #768394;
box-shadow:none
}
.btn-group .btn-next, .input-group-prepend .btn-next, .input-group-append .btn-next {
border-right: 1px solid #768394;
border-left:1px solid #768394
}
.btn-outline-next {
border-color: #8897AA;
background: transparent;
color: #8897AA;
}
.btn-outline-next:hover {
border-color: transparent;
background: #8897AA;
color: #fff;
}
.badge-md {
font-size: 0.95em;
}
.table.table-sm td {
font-size: 0.9em;
}
.badge-next {
background-color: #8897AA;
color:#fff;
}
.badge-next[href]:hover, .badge-next[href]:focus {
background-color: #768394;
color:#fff;
text-decoration: none;
}
.badge-dark {
background-color: rgba(200, 21, 176, 0.9);
color: #fff;
}
.badge-dark[href]:hover, .badge-dark[href]:focus {
background-color: rgb(176, 21, 152);
}
.badge-success {
background-color: #94ae59;
color: #fff;
}
.text-success {
color: #94ae59 !important;
}
.default-style .datepicker-dropdown {
z-index: 2080 !important;
}
.default-style .dtp {
z-index: 2080;
}
.table th, .table td {
padding: 0.4rem;
}
.dz-message i {
font-size: 50px;
display: block;
margin-bottom: 16px;
opacity: 0.8;
}
div.dropzone {
border-style: dashed;
}
div.dropzone.dz-drag-hover {
border-style: dashed;
}
.ql-picker.ql-placeholder {
width: 102px;
}
.ql-picker.ql-placeholder > span.ql-picker-label::before {
content: 'Platzhalter';
}
.ql-picker.ql-placeholder > span.ql-picker-options > span.ql-picker-item::before {
content: attr(data-label);
}
.nav-tabs-top > .nav .nav-link{
line-height: 1.3em;
background-color: rgba(24, 28, 33, 0.10);
border-color: rgba(24, 28, 33, 0.15);
}
.nav-tabs-top > .nav .nav-link:hover{
line-height: 1.3em;
border-color: rgba(24, 28, 33, 0.25);
}
.nav-tabs-top > .nav .nav-link.active {
color: #f2ffea;
background-color: #646d93;
font-weight: bold;
border-color: rgba(24, 28, 33, 0.25);
}
.nav-tabs-top > .nav {
padding-left: 0.25em;
padding-right: 0.25em;
}
.nav-tabs-top > .tab-content {
border: none;
}
@media (min-width: 768px) {
#filter_email_templates_directory {
position: absolute;width: 50%;z-index: 999;margin-top: -5px;
}
}
.no-break {
white-space: nowrap;
}
.card-header,
.card-footer,
.card hr {
border-color: rgba(24, 28, 33, 0.15);
}
.card hr {
border-color: rgba(24, 28, 33, 0.15);
}
h6.card-header {
font-size: 1rem;
}
.layout-2 .layout-content {
max-width: 1200px;
}
.btn-submit {
background-color: #8f3580;
color: #f2ffea;
}

View file

@ -1,3 +1,41 @@
::-webkit-scrollbar {
width: 8px;
height: 9px;
}
/* Track */
::-webkit-scrollbar-track {
-webkit-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
}
/* Handle */
::-webkit-scrollbar-thumb {
-webkit-border-radius: 2px;
border-radius: 2px;
background: #7b83ff;
-webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
}
::-webkit-scrollbar-thumb:window-inactive {
background: #7b83ff;
}
.table-responsive-track {
width: 100%;
height: 9px;
background-color: transparent;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.table-responsive-thumb {
width: 100%;
height: 1px;
background-color:transparent;
-webkit-overflow-scrolling: touch;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.table-responsive .dropdown-menu, .table-responsive .dropdown-menu,
.table-responsive .dropdown-toggle { .table-responsive .dropdown-toggle {
@ -11,6 +49,13 @@
} }
} }
.btn-light {
background: rgba(245, 245, 245, 1);
}
.btn-light:hover {
background: rgba(245, 245, 245, 0.8);
}
.table-responsive { .table-responsive {
overflow: auto; overflow: auto;
overflow-y: visible; overflow-y: visible;
@ -245,16 +290,6 @@ li li li li li div.dd-content-link {
} }
.switcher-on-off.switcher .switcher-input ~ .switcher-indicator {
background: #d9534f;
color: #fff;
}
.switcher-on-off.switcher .switcher-input:checked ~ .switcher-indicator {
background: #648859;
color: #fff;
}
.note-toolbar.card-header { .note-toolbar.card-header {
background-color: #f0f0f0; background-color: #f0f0f0;
} }
@ -454,14 +489,6 @@ figcaption {
} }
.badge-success {
background-color: #94ae59;
color: #fff;
}
.text-success {
color: #94ae59 !important;
}
.default-style .datepicker-dropdown { .default-style .datepicker-dropdown {
@ -488,42 +515,19 @@ div.dropzone.dz-drag-hover {
} }
.ql-picker.ql-placeholder { .ql-picker.ql-placeholder {
width: 102px; width: 46px;
} }
.ql-picker.ql-placeholder > span.ql-picker-label::before { .ql-picker.ql-placeholder > span.ql-picker-label::before {
content: 'Platzhalter'; font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: "\f021";
} }
.ql-picker.ql-placeholder > span.ql-picker-options > span.ql-picker-item::before { .ql-picker.ql-placeholder > span.ql-picker-options > span.ql-picker-item::before {
content: attr(data-label); content: attr(data-label);
} }
.nav-tabs-top > .nav .nav-link{
line-height: 1.3em;
background-color: rgba(24, 28, 33, 0.10);
border-color: rgba(24, 28, 33, 0.15);
}
.nav-tabs-top > .nav .nav-link:hover{
line-height: 1.3em;
border-color: rgba(24, 28, 33, 0.25);
}
.nav-tabs-top > .nav .nav-link.active {
color: #66500f;
background-color: #ffc926;
font-weight: bold;
border-color: rgba(24, 28, 33, 0.25);
}
.nav-tabs-top > .nav {
padding-left: 0.25em;
padding-right: 0.25em;
}
.nav-tabs-top > .tab-content {
border: none;
}
@media (min-width: 768px) { @media (min-width: 768px) {
#filter_email_templates_directory { #filter_email_templates_directory {
position: absolute;width: 50%;z-index: 999;margin-top: -5px; position: absolute;width: 50%;z-index: 999;margin-top: -5px;
@ -539,3 +543,30 @@ div.dropzone.dz-drag-hover {
border-color: rgba(24, 28, 33, 0.15); border-color: rgba(24, 28, 33, 0.15);
} }
h6.card-header {
font-size: 1rem;
}
.custom-select.small-select {
height: calc(1.8rem + 2px);
padding: 0.238rem 2.75rem 0.238rem 0.875rem;
line-height: 1.54;
}
.max-width-md {
width: 100%;
}
@media (min-width: 992px){
.max-width-md {
width: 760px;
}
}
@media (min-width: 1180px){
.max-width-md {
width: 921px;
}
}
.layout-2 .layout-content.max-width-100 {
max-width: 100%;
}

View file

@ -76,7 +76,7 @@ strong {
height: 10mm; height: 10mm;
z-index: 1; z-index: 1;
font-size: 10pt; font-size: 10pt;
line-height: 12pt; line-height: 1.2em;
text-align: right; text-align: right;
color:#000; color:#000;
} }
@ -93,12 +93,12 @@ strong {
} }
#title_box .title { #title_box .title {
font-size: 16pt; font-size: 16pt;
line-height: 12pt; line-height: 1.2em;
color:#000; color:#000;
} }
#title_box .subtitle { #title_box .subtitle {
font-size: 9pt; font-size: 9pt;
line-height: 9pt; line-height: 1.2em;
color:#000; color:#000;
} }
@ -115,7 +115,7 @@ strong {
#detail_box table { #detail_box table {
width: 100%; width: 100%;
line-height: 9pt; line-height: 1.2em;
border-collapse: collapse; border-collapse: collapse;
color:#000; color:#000;
} }
@ -154,7 +154,7 @@ strong {
height: 30mm; height: 30mm;
z-index: 6; z-index: 6;
font-size: 7pt; font-size: 7pt;
line-height: 8pt; line-height: 1em;
} }
#footer_box table { #footer_box table {

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more