diff --git a/.env b/.env index 860c260..82b5377 100755 --- a/.env +++ b/.env @@ -2,40 +2,30 @@ APP_NAME="STERN TOURS CRM" APP_ENV=local APP_KEY=base64:cxq+xNckU1xLwp8V9Bfj9+nOK5iZL6urcZ1EBO8usXg= APP_DEBUG=true -APP_URL=http://mein.sterntours.local -APP_OLD_URL=https://cms-stern-tours.local +APP_URL=http://mein.sterntours.test +APP_OLD_URL=https://cms-stern-tours.test #APP_URL_V2=https://v2.stern-tours.de -APP_URL_V2=http://v2-sterntours.local +APP_URL_V2=http://v2-sterntours.test #APP_URL_STERN=https://www.sterntours.de -APP_URL_STERN=http://sterntours.local +APP_URL_STERN=http://sterntours.test LOG_CHANNEL=stack - - -#DB_CONNECTION=mysql -#DB_HOST=localhost -#DB_PORT=3306 -#DB_DATABASE=cmssso_db1 -#DB_USERNAME=root -#DB_PASSWORD=KT32vQ7 -# on neptune DB_CONNECTION=mysql -DB_HOST=localhost +DB_HOST=192.168.1.8 DB_PORT=3306 DB_DATABASE=cmssso_db1 -DB_USERNAME=root -DB_PASSWORD=KT32vQ7 - +DB_USERNAME=kadmin +DB_PASSWORD=KT32vQ7ix DB_CONNECTION_STERN=mysql -DB_HOST_STERN=localhost +DB_HOST_STERN=192.168.1.8 DB_PORT_STERN=3306 -DB_DATABASE_STERN=sterntours -DB_USERNAME_STERN=root -DB_PASSWORD_STERN=KT32vQ7 +DB_DATABASE_STERN=relaunch1 +DB_USERNAME_STERN=kadmin +DB_PASSWORD_STERN=KT32vQ7ix BROADCAST_DRIVER=log diff --git a/.idea/.name b/.idea/.name index b04698a..a522bc9 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -mein.sterntours \ No newline at end of file +mein.sterntours.test \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 7688ec4..55c2f39 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/mein.sterntours.iml b/.idea/mein.sterntours.test.iml similarity index 73% rename from .idea/mein.sterntours.iml rename to .idea/mein.sterntours.test.iml index 6321464..d93092c 100644 --- a/.idea/mein.sterntours.iml +++ b/.idea/mein.sterntours.test.iml @@ -2,12 +2,13 @@ - - + + + @@ -24,12 +25,27 @@ + + + + + + + + + + + + + + + @@ -38,7 +54,10 @@ + + + diff --git a/.idea/modules.xml b/.idea/modules.xml index 1ccbf38..2313240 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 8a2af3c..7047750 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -131,6 +131,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2739eb7..1da3c9b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,24 @@ - - - - - + + + + + + + + + + + + + + + + + + @@ -26,90 +39,91 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - + + @@ -159,14 +173,149 @@ + + - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -369,9 +537,9 @@ - + - + @@ -382,11 +550,11 @@ - + + - + - @@ -705,7 +873,37 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -732,18 +930,25 @@ + + + + + - + - + + + @@ -753,37 +958,29 @@ - - - + - - - - + + + + + + + + - - + + + - - - - - - - file://$PROJECT_DIR$/resources/views/booking/detail.blade.php - 313 - - - + \ No newline at end of file diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index ba502bf..55b0404 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -5,7 +5,7 @@ namespace PHPSTORM_META { /** * PhpStorm Meta file, to provide autocomplete information for PhpStorm - * Generated on 2020-03-11 14:36:00. + * Generated on 2020-04-08 15:47:00. * * @author Barry vd. Heuvel * @see https://github.com/barryvdh/laravel-ide-helper @@ -41,6 +41,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -202,6 +204,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -363,6 +367,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -524,6 +530,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -685,6 +693,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -846,6 +856,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1007,6 +1019,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1168,6 +1182,8 @@ namespace PHPSTORM_META { 'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class, 'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, 'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, + 'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class, + 'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class, 'Reliese\Coders\Model\Factory' => \Reliese\Coders\Model\Factory::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, diff --git a/_ide_helper.php b/_ide_helper.php index c2d2989..ab23988 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -3,7 +3,7 @@ /** * A helper file for Laravel 5, to provide autocomplete information to your IDE - * Generated for Laravel 6.17.0 on 2020-03-11 14:36:00. + * Generated for Laravel 6.18.5 on 2020-04-08 15:47:00. * * This file should not be included in your code, only analyzed by your IDE! * @@ -506,8 +506,6 @@ namespace Illuminate\Support\Facades { /** * Resolve the given type from the container. - * - * (Overriding Container::make) * * @param string $abstract * @param array $parameters @@ -522,8 +520,6 @@ namespace Illuminate\Support\Facades { /** * Determine if the given abstract type has been bound. - * - * (Overriding Container::bound) * * @param string $abstract * @return bool @@ -2734,7 +2730,6 @@ namespace Illuminate\Support\Facades { * * @param mixed $command * @return mixed - * @throws \RuntimeException * @static */ public static function dispatchToQueue($command) @@ -9961,7 +9956,9 @@ namespace Illuminate\Support\Facades { * Gets the preferred format for the response by inspecting, in the following order: * * the request format set using setRequestFormat * * the values of the Accept HTTP header - * * the content type of the body of the request. + * + * Note that if you use this method, you should send the "Vary: Accept" header + * in the response to prevent any issues with intermediary HTTP caches. * * @static */ @@ -16437,7 +16434,9 @@ namespace Illuminate\Support\Facades { * Gets the preferred format for the response by inspecting, in the following order: * * the request format set using setRequestFormat * * the values of the Accept HTTP header - * * the content type of the body of the request. + * + * Note that if you use this method, you should send the "Vary: Accept" header + * in the response to prevent any issues with intermediary HTTP caches. * * @static */ diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 160319c..0263eca 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -80,94 +80,6 @@ namespace App{ class User extends \Eloquent {} } -namespace App\Models{ -/** - * App\Models\Booking - * - * @property int $id - * @property string|null $booking_date - * @property int $customer_id - * @property int|null $lead_id - * @property int|null $new_drafts - * @property int $sf_guard_user_id - * @property int $branch_id - * @property float|null $service_fee - * @property int|null $travel_country_id - * @property int|null $travel_category_id - * @property int|null $pax - * @property int|null $coupon_id - * @property \Illuminate\Support\Carbon $created_at - * @property \Illuminate\Support\Carbon $updated_at - * @property string|null $title - * @property string|null $start_date - * @property string|null $end_date - * @property int|null $website_id - * @property string|null $travel_number - * @property string|null $participant_name - * @property string|null $participant_firstname - * @property string|null $participant_birthdate - * @property int|null $participant_salutation_id - * @property string|null $ev_number - * @property string|null $merlin_knr - * @property string|null $merlin_order_number - * @property int|null $travel_company_id - * @property int|null $travel_documents - * @property float|null $price - * @property float|null $price_total - * @property float|null $deposit_total - * @property float|null $final_payment - * @property string|null $final_payment_date - * @property int|null $travelagenda_id - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Sym\Arrangement[] $arrangements - * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingDraftItem[] $booking_draft_items - * @property-read \App\Models\TravelCountry|null $lead - * @property-read \App\Models\SfGuardUser $sf_guard_user - * @property-read \App\Models\TravelAgenda|null $travel_agenda - * @property-read \App\Models\TravelCountry|null $travel_country - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBookingDate($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereBranchId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCouponId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCustomerId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereDepositTotal($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEndDate($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereEvNumber($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPayment($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFinalPaymentDate($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereLeadId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinKnr($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereMerlinOrderNumber($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNewDrafts($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantBirthdate($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantFirstname($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantName($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereParticipantSalutationId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePax($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePrice($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceTotal($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereServiceFee($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereSfGuardUserId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereStartDate($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTitle($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCategoryId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCompanyId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelCountryId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelDocuments($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelNumber($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereTravelagendaId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value) - * @mixin \Eloquent - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking query() - * @property-read int|null $arrangements_count - * @property-read int|null $booking_draft_items_count - */ - class _Booking extends \Eloquent {} -} - namespace App\Models\Sym{ /** * App\Models\Sym\TravelCountry @@ -200,6 +112,8 @@ namespace App\Models\Sym{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactLands($value) * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Booking[] $bookings * @property-read int|null $bookings_count + * @property array|null $contact_emails + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactEmails($value) */ class TravelCountry extends \Eloquent {} } @@ -289,6 +203,40 @@ namespace App\Models\Sym{ class Arrangement extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingInvoice + * + * @property int $id + * @property int $booking_id + * @property float $total + * @property float $deposit + * @property float $final_payment + * @property Carbon $deposit_payment_date + * @property Carbon $final_payment_date + * @property boolean $binary_data + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereBinaryData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereDeposit($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereDepositPaymentDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereFinalPayment($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereFinalPaymentDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereTotal($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingInvoice whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingInvoice extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\TravelProgramDraft @@ -464,6 +412,44 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value) * @mixin \Eloquent * @property-read int|null $service_provider_entries_count + * @property float|null $canceled + * @property float|null $price_canceled + * @property int|null $paying_out + * @property int|null $paying_out_status + * @property int|null $airline_id + * @property int|null $refund + * @property \Illuminate\Support\Carbon|null $refund_date + * @property int|null $hold + * @property int|null $xx_tkt + * @property string|null $xx_tkt_date + * @property string|null $filekey + * @property-read \App\Models\Airline|null $airline + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails + * @property-read int|null $customer_mails_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails_sent_at + * @property-read int|null $customer_mails_sent_at_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereAirlineId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCanceled($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFilekey($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereHold($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOut($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOutStatus($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceCanceled($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefund($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefundDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTkt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTktDate($value) + * @property int|null $is_rail_fly + * @property string|null $notice + * @property-read \App\Models\CustomerMail $customer_mail_last + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereIsRailFly($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNotice($value) + * @property-read int|null $booking_applications_count + * @property-read int|null $booking_confirmations_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingStorno[] $booking_stornos + * @property-read int|null $booking_stornos_count + * @property-read int|null $booking_vouchers_count + * @property-read int|null $travel_insurances_count */ class Booking extends \Eloquent {} } @@ -725,6 +711,30 @@ namespace App\Models{ class TravelPageGuide extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingVoucher + * + * @property int $id + * @property int $booking_id + * @property boolean $binary_data + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereBinaryData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingVoucher whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingVoucher extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\IQContentTreeNode @@ -880,8 +890,18 @@ namespace App\Models{ * @property int $booking_id * @property int $customer_id * @property int $lead_id + * @property bool $is_answer + * @property int $reply_id + * @property string $email + * @property string $recipient + * @property string $cc + * @property string $bcc * @property string $subject * @property string $message + * @property int $dir + * @property int $travel_country_id + * @property bool $draft + * @property bool $important * @property bool $send * @property bool $fail * @property string $error @@ -892,24 +912,40 @@ namespace App\Models{ * @property Carbon $updated_at * @property Booking $booking * @property Customer $customer + * @property CustomerMail $customer_mail + * @property TravelCountry $travel_country * @property Lead $lead + * @property Collection|CustomerFile[] $customer_files + * @property Collection|CustomerMail[] $customer_mails * @package App\Models + * @property-read int|null $customer_files_count + * @property-read int|null $customer_mails_count * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereBcc($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCc($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCustomerId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDeliveredAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDir($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDraft($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereEmail($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereError($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereFail($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereImportant($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereIsAnswer($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereLeadId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereMessage($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereRecipient($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereReplyId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereScheduledAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSend($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSentAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubject($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereTravelCountryId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereUpdatedAt($value) * @mixin \Eloquent */ @@ -1170,6 +1206,33 @@ namespace App\Models{ class InitialContactType extends \Eloquent {} } +namespace App\Models{ +/** + * Class Airline + * + * @property int $id + * @property string $name + * @property string $name_full + * @property Carbon $created_at + * @property Carbon $updated_at + * @package App\Models + * @property array|null $contact_emails + * @property array|null $emails + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereContactEmails($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereEmails($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereNameFull($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereUpdatedAt($value) + * @mixin \Eloquent + */ + class Airline extends \Eloquent {} +} + namespace App\Models{ /** * Class FewoLodgingType @@ -1268,6 +1331,32 @@ namespace App\Models{ class DraftItem extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingApplication + * + * @property int $id + * @property int $booking_id + * @property float $total + * @property boolean $binary_data + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereBinaryData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereTotal($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingApplication whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingApplication extends \Eloquent {} +} + namespace App\Models{ /** * Class FewoLodgingImage @@ -1321,6 +1410,46 @@ namespace App\Models{ class LeadParticipant extends \Eloquent {} } +namespace App\Models{ +/** + * Class CustomerFile + * + * @property int $id + * @property int $customer_id + * @property int $customer_mail_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 $created_at + * @property Carbon $updated_at + * @property Customer $customer + * @property CustomerMail $customer_mail + * @package App\Models + * @property-read \App\User $user + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCustomerId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereCustomerMailId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereDir($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereExt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereFilename($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereIdentifier($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereMine($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereOriginalName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereSize($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFile whereUpdatedAt($value) + * @mixin \Eloquent + */ + class CustomerFile extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\Account @@ -1447,6 +1576,8 @@ namespace App\Models{ * @property array|null $contact_lands * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactLands($value) * @property-read int|null $travel_nationality_requirements_count + * @property array|null $contact_emails + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactEmails($value) */ class TravelCountry extends \Eloquent {} } @@ -1721,21 +1852,24 @@ namespace App\Models{ namespace App\Models{ /** - * App\Models\Status + * Class Status * * @property int $id * @property string $name * @property int $handling_days - * @property string|null $color - * @property-read \App\Models\Status $status + * @property string $color + * @property Collection|Lead[] $leads + * @property Collection|StatusHistory[] $status_histories + * @package App\Models + * @property-read int|null $leads_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status query() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereColor($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereHandlingDays($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereName($value) * @mixin \Eloquent - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status query() */ class Status extends \Eloquent {} } @@ -1761,6 +1895,40 @@ namespace App\Models{ class TravelCategory extends \Eloquent {} } +namespace App\Models{ +/** + * Class TravelInsurance + * + * @property int $id + * @property int $booking_id + * @property string $policy_number + * @property string $ak + * @property string $an + * @property string $akt + * @property float $premium + * @property string $request_data + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAk($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAkt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereAn($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance wherePolicyNumber($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance wherePremium($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereRequestData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelInsurance whereUpdatedAt($value) + * @mixin \Eloquent + */ + class TravelInsurance extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\IQContentSite @@ -2276,6 +2444,8 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereWebsiteId($value) * @mixin \Eloquent * @property-read \App\Models\Sym\TravelCountry|null $travel_country_crm + * @property bool|null $is_rebook + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereIsRebook($value) */ class Lead extends \Eloquent {} } @@ -2524,6 +2694,8 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValidDate($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereValue($value) * @mixin \Eloquent + * @property string|null $text + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Coupon whereText($value) */ class Coupon extends \Eloquent {} } @@ -2858,6 +3030,40 @@ namespace App\Models{ class TravelUser extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingConfirmation + * + * @property int $id + * @property int $booking_id + * @property float $total + * @property float $deposit + * @property float $final_payment + * @property Carbon $deposit_payment_date + * @property Carbon $final_payment_date + * @property boolean $binary_data + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereBinaryData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereDeposit($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereDepositPaymentDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereFinalPayment($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereFinalPaymentDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereTotal($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingConfirmation whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingConfirmation extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\CMSInfo @@ -2943,6 +3149,38 @@ namespace App\Models{ class IQContentTree extends \Eloquent {} } +namespace App\Models{ +/** + * Class BookingStorno + * + * @property int $id + * @property int $booking_id + * @property float $total + * @property float $storno + * @property Carbon $storno_date + * @property boolean $binary_data + * @property bool $done + * @property Carbon $created_at + * @property Carbon $updated_at + * @property Booking $booking + * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereBinaryData($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereDone($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStorno($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStornoDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereTotal($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereUpdatedAt($value) + * @mixin \Eloquent + */ + class BookingStorno extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\SfGuardUser diff --git a/app/Http/Controllers/Admin/ReportController.php b/app/Http/Controllers/Admin/ReportController.php index f4e9e3c..b59c371 100755 --- a/app/Http/Controllers/Admin/ReportController.php +++ b/app/Http/Controllers/Admin/ReportController.php @@ -24,13 +24,12 @@ class ReportController extends Controller $this->middleware('superadmin'); } - public function bookings() { $data = [ - 'text' => "Umsetzung folgt", + //'serviceProviders' => ServiceProvider::all(), ]; - return view('_empty', $data); + return view('admin.report.bookings', $data); } public function providers() @@ -38,10 +37,234 @@ class ReportController extends Controller $data = [ 'serviceProviders' => ServiceProvider::all(), ]; - return view('admin.report.index', $data); + return view('admin.report.service_providers', $data); } - public function providersExport(){ + private function prozessBookingSearch() + { + + $query = Booking::with( 'customer', 'lead', 'service_provider_entries', 'service_provider_entries.service_provider'); + + 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') != ""){ + $travel_date_from = Carbon::parse(Request::get('filter_booking_date_from'))->format("Y-m-d"); + $query->where("booking_date", '>=', $travel_date_from); + } + if(Request::get('filter_booking_date_to') != ""){ + $travel_date_to = Carbon::parse(Request::get('filter_booking_date_to'))->format("Y-m-d"); + $query->where("booking_date", '<=', $travel_date_to); + } + + return $query; + } + + public function bookingsDatatable() + { + $query = $this->prozessBookingSearch(); + + return \DataTables::eloquent($query) + ->with('price_total_sum', function() use ($query) { + return Util::_number_format($query->sum('price')); + }) + ->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->proceedsRaw(); + } + return Util::_number_format($proceeds); + }) + ->addColumn('id', function (Booking $booking) { + return '' . $booking->id . ''; + }) + ->addColumn('customer.fullName', function (Booking $booking) { + return $booking->customer->fullName(); + }) + ->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('service_provider.names', function (Booking $booking) { + $ret = ""; + if($booking->service_provider_entries){ + foreach ($booking->service_provider_entries as $service_provider_entry){ + $ret .= ''.$service_provider_entry->service_provider->name." | "; + $ret .= $service_provider_entry->getAmountFinalEur()." | "; + $ret .= $service_provider_entry->is_cleared ? '' : ''; + $ret .= "
"; + } + } + return $ret === "" ? "-" : $ret; + }) + ->addColumn('lead.status_id', function (Booking $booking) { + //umbuchen + if($booking->lead->status_id){ + $color = $booking->lead->status->color; + $icon = ""; + if($booking->lead->status_id == 14 && $booking->lead->is_rebook){ + $color = '#94ae59'; + $icon = ' '; + } + if($booking->lead->status_id == 14 && !$booking->lead->is_rebook){ + $icon = ' '; + } + return ''.$icon.$booking->lead->status->name.''; + } + return '-'; + }) + ->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('start_date', 'start_date $1') + ->orderColumn('customer.fullName', 'customer.firstname $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(); + $query->orderBy("id", 'ASC'); + + + $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', + 'MyJack Nr.', + 'Reisepreis', + 'Erlös', + 'Kunde', + 'Reisedatum', + 'bis', + 'Buchungsdatum', + 'Reiseland', + 'Reiseprogramm', + 'Reiseteilnehmer', + 'Leistungsträger', + 'Zahlung', + 'Zahlungsdatum', + 'Rechnungsnummer', + 'abgeschlossen', + ); + $total_price = 0; + $total_proceeds = 0; + $total_amount_final = 0; + + foreach($exports as $export) { + if($export->service_provider_entries->count()){ + $new = true; + foreach ($export->service_provider_entries as $service_provider_entry){ + if($new){ + $total_price += $export->getPriceRaw(); + $total_proceeds += $export->proceedsRaw(); + } + $total_amount_final += $service_provider_entry->getAmountFinalEurRaw(); + $columns[] = array( + 'BuchungsID' => $new ? $export->id : "", + 'Status' => $new ? $export->lead->status->name : "", + 'MyJack Nr.' => $new ? $export->merlin_order_number : "", + 'Reisepreis' => $new ? $export->price : "", + '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->getPriceRaw(); + $columns[] = array( + 'BuchungsID' => $export->id, + 'Status' => $export->lead->status->name, + 'MyJack Nr.' => $export->merlin_order_number, + 'Reisepreis' => $export->price, + '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' => "", + 'MyJack Nr.' => "", + 'Reisepreis' => Util::_number_format($total_price), + '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'); + } + + private function prozessProvidersSearch(){ + $query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer'); if(Request::get('filter_is_cleared') != ""){ @@ -63,6 +286,87 @@ class ReportController extends Controller }); } + + 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){ + $price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceRaw(); + $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->proceedsRaw(); + $isset[] = $v->booking->lead_id; + } + return Util::_number_format($proceeds); + /*$all = $query->get(); + $proceeds = 0; + foreach ($all as $v){ + $proceeds += $v->proceedsRaw(); + } + return Util::_number_format($proceeds);*/ + }) + ->addColumn('booking.id', function (ServiceProviderEntry $serviceProviderEntry) { + return '' . $serviceProviderEntry->booking->id . ''; + }) + ->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) { + return $serviceProviderEntry->booking->customer->fullName(); + }) + ->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('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) { + return $serviceProviderEntry->is_cleared ? ' ' : ''; + }) + ->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.start_date', 'booking.start_date $1') + ->orderColumn('booking.end_date', 'booking.end_date $1') + ->orderColumn('is_cleared', 'is_cleared $1') + ->rawColumns(['is_cleared', 'booking.id']) + ->make(true); + } + + public function providersExport() + { + $query = $this->prozessProvidersSearch(); + $query->whereHas('booking', function ($q) { $q->orderBy("lead_id", 'ASC'); }); @@ -70,6 +374,7 @@ class ReportController extends Controller $filename = "file-".date('Y-m-d-H-i-s'); $exports = $query->get(); $columns = []; + if(Request::get('export') === "export"){ $filename = "Export_".date('Y-m-d-H-i-s'); @@ -91,8 +396,16 @@ class ReportController extends Controller 'Konto', ); $isset = []; + $total_price = 0; + $total_amount_final = 0; + $total_proceeds = 0; foreach($exports as $export) { $new = in_array($export->booking->lead_id, $isset) ? false : true; + if($new){ + $total_price += $export->booking->getPriceRaw(); + $total_proceeds += $export->booking->proceedsRaw(); + } + $total_amount_final += $export->getAmountFinalEurRaw(); $columns[] = array( 'Zähler' => $new ? $export->getCounter() : "", 'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "", @@ -112,6 +425,23 @@ class ReportController extends Controller ); $isset[] = $export->booking->lead_id; } + $columns[] = array( + 'Zähler' => "Total", + 'MyJack Nr.' => "", + 'CRM Nr' => "", + 'Kunde' =>"", + 'Reisedatum' => "", + 'Gesamtreisepreis' => Util::_number_format($total_price), + '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'); @@ -131,8 +461,14 @@ class ReportController extends Controller 'ZahlungVorgang', ); $isset = []; + $total_amount_final = 0; + $payments_total = 0; foreach($exports as $export) { $new = in_array($export->booking->lead_id, $isset) ? false : true; + if($new) { + $payments_total += $export->booking->getServiceProviderPaymentsTotalRaw(); + } + $total_amount_final += $export->getAmountFinalEurRaw(); $columns[] = array( 'Zähler' => $new ? $export->getCounter() : "", 'MyJack Nr.' => $new ? $export->booking->merlin_order_number : "", @@ -149,67 +485,23 @@ class ReportController extends Controller ); $isset[] = $export->booking->lead_id; } + $columns[] = array( + 'Zähler' => "Total", + 'MyJack Nr.' => "", + 'CRM Nr' => "", + 'Kunde' => "", + 'Reisedatum' => "", + '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'); } - - - - - public function providersDatatable() - { - - $query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer'); - - 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); - }); - } - - return \DataTables::eloquent($query) - ->addColumn('booking.customer.fullName', function (ServiceProviderEntry $serviceProviderEntry) { - return $serviceProviderEntry->booking->customer->fullName(); - }) - ->addColumn('booking.proceeds', function (ServiceProviderEntry $serviceProviderEntry) { - return $serviceProviderEntry->booking->proceeds(); - }) - ->addColumn('booking.start_date', function (ServiceProviderEntry $serviceProviderEntry) { - return $serviceProviderEntry->booking->getStartDateFormat(); - }) - ->addColumn('is_cleared', function (ServiceProviderEntry $serviceProviderEntry) { - return $serviceProviderEntry->is_cleared ? ' ' : ''; - }) - ->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.start_date', 'booking.start_date $1') - ->orderColumn('is_cleared', 'is_cleared $1') - ->rawColumns(['is_cleared']) - ->make(true); - - } - } diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index 070acb8..65a8a8a 100755 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -7,6 +7,7 @@ use App\Models\BookingDraftItem; use App\Models\Customer; use App\Repositories\BookingRepository; use App\Repositories\CustomerMailRepository; +use App\Repositories\DraftRepository; use Request; class BookingController extends Controller @@ -64,7 +65,7 @@ class BookingController extends Controller $i = 1; - if($data['action'] == 'addItemUp'){ + if($data['action'] === 'addItemUp'){ $travel_program_id = null; $request_date = null; $comfort = 0; @@ -98,8 +99,6 @@ class BookingController extends Controller ]); $i++; } - - if(isset($data['draft_item'])){ foreach ($data['draft_item'] as $booking_draft_item_id => $draft_item){ @@ -116,12 +115,10 @@ class BookingController extends Controller $draft_item['in_pdf'] = isset($draft_item['in_pdf']) ? true : false; $BookingDraftItem->fill($draft_item); - $BookingDraftItem->save(); } } - - if($data['action'] == 'addItemDown'){ + if($data['action'] === 'addItemDown'){ $travel_program_id = null; $request_date = null; $comfort = 0; @@ -183,7 +180,6 @@ class BookingController extends Controller } \Session()->flash('alert-save', '1'); return redirect(route('booking_detail', [$booking->id])); - } @@ -193,11 +189,11 @@ class BookingController extends Controller if(Request::ajax()){ $data['customers'] = []; if($data['action'] === "new-customer-mail" && isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])){ - $tmp = ""; - $tmp .= $booking->customer ? $booking->customer->email." | " : "- | "; - $tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | "; - $tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | "; - $tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-"; + $tmp = []; + $tmp['email'] = $booking->customer ? $booking->customer->email : ""; + $tmp['name'] = $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | "; + $tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | "; + $tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-"; $data['customers'][$booking->id] = $tmp; } $ret = CustomerMailRepository::loadModal($data); @@ -215,7 +211,17 @@ class BookingController extends Controller return redirect(route('booking_detail', [$booking->id])); } + public function action($action, $id=false){ + if($action === 'change_travel_dates'){ + if($booking = Booking::find($id)){ + $draftRepo = new DraftRepository($booking); + $draftRepo->change_dates_drafts_from_booking(Request::get('change_travel_start_date')); + \Session()->flash('alert-success', __('Datum der Reise wurde geändert')); + return redirect(route('booking_detail', [$booking->id])); + } + } + } } diff --git a/app/Http/Controllers/CMS/CMSContentCountryController.php b/app/Http/Controllers/CMS/CMSContentCountryController.php index 21021a2..9c79464 100755 --- a/app/Http/Controllers/CMS/CMSContentCountryController.php +++ b/app/Http/Controllers/CMS/CMSContentCountryController.php @@ -53,6 +53,11 @@ class CMSContentCountryController extends Controller { $data = Request::all(); + if(isset($data['contact_emails'])){ + $data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails'])); + }else{ + $data['contact_emails'] = null; + } if(!isset($data['contact_lands'])){ $data['contact_lands'] = null; } diff --git a/app/Http/Controllers/CustomerFileController.php b/app/Http/Controllers/CustomerFileController.php new file mode 100755 index 0000000..2553c91 --- /dev/null +++ b/app/Http/Controllers/CustomerFileController.php @@ -0,0 +1,114 @@ +middleware('admin'); + $this->customerFileRepo = $customerFileRepo; + } + + public function index() + { + $data = [ + + ]; + return view('customer.mail.index', $data); + } + + public function show($model, $id, $cd = false){ + + $content_disposition = $cd ? 'attachment' : 'inline'; + + $file = false; + $filename = ""; + switch ($model){ + case 'booking_application': + if($booking_application = BookingApplication::find($id)){ + $filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf"; + $file = base64_decode($booking_application->binary_data); + } + break; + case 'booking_confirmation': + if($booking_confirmation = BookingConfirmation::find($id)){ + $filename = "Reisebestaetigung-".$booking_confirmation->booking->getBookingNumber().".pdf"; + $file = base64_decode($booking_confirmation->binary_data); + } + break; + case 'booking_storno': + if($booking_stornos = BookingStorno::find($id)){ + $filename = "Reisestornierung-".$booking_stornos->booking->getBookingNumber().".pdf"; + $file = base64_decode($booking_stornos->binary_data); + } + break; + case 'coupon': + if($coupon = Coupon::find($id)){ + $filename = "Gutschein-".$coupon->number.".pdf"; + + $pdf = new CreateCouponPDF($coupon); + $pdf->create(); + return $pdf->output($filename, $cd); + + } + break; + case 'booking_voucher': + if($booking_vouchers = BookingVoucher::find($id)){ + $filename = "Voucher-".$booking_vouchers->booking->getBookingNumber().".pdf"; + $file = base64_decode($booking_vouchers->binary_data); + } + break; + case 'insurance_certificate': + if($insurance_certificate = InsuranceCertificate::find($id)){ + $filename = $insurance_certificate->filename; + $file = base64_decode($insurance_certificate->binary_data); + } + break; + case 'travel_insurance': + if($booking_application = TravelInsurance::find($id)){ + $filename = "Buchungsauftrag-".$booking_application->booking->getBookingNumber().".pdf"; + $file = base64_decode($booking_application->binary_data); + } + break; + + } + + + if($file){ + return Response::make($file, 200, [ + 'Content-Type' => 'application/pdf', + 'Content-Disposition' => $content_disposition.'; filename="'.$filename.'"' + ]); + } + + die( 'error' ); + } + + + //$path = storage_path($filename); //file_get_contents($path) + + //return response()->file($pathToFile, $headers); + //return response()->download($pathToFile, $name, $headers); +} + + diff --git a/app/Http/Controllers/CustomerMailController.php b/app/Http/Controllers/CustomerMailController.php index e630a22..1538f3b 100755 --- a/app/Http/Controllers/CustomerMailController.php +++ b/app/Http/Controllers/CustomerMailController.php @@ -6,7 +6,7 @@ use App\Models\Customer; use App\Models\CustomerFile; use App\Models\CustomerMail; use App\Repositories\CustomerMailRepository; -use App\Repositories\FileRepository; +use App\Repositories\CustomerFileRepository; use Carbon; use Illuminate\Database\Eloquent\Collection; use Illuminate\Support\Facades\URL; @@ -64,9 +64,14 @@ class CustomerMailController extends Controller } public function delete($id){ - /* - \Session()->flash('alert-success', __('Eintrag gelöscht')); - return redirect(route('lead_detail', [$lead->id]));*/ + $customer_mail = CustomerMail::find($id); + $customer_mail->dir = 12; + $customer_mail->travel_country_id = null; + $customer_mail->draft = false; + $customer_mail->save(); + + \Session()->flash('alert-success', __('Mail gelöscht')); + return back(); } @@ -108,7 +113,11 @@ class CustomerMailController extends Controller public function sendMail(CustomerMailRepository $customerMailRepository){ $data = Request::all(); $customerMailRepository->sendAndStore($data); - \Session()->flash('alert-success', "Mails gesendet!"); + if($data['action'] == 'draft'){ + \Session()->flash('alert-success', "Entwurf gespeichert!"); + }else{ + \Session()->flash('alert-success', "Mail gesendet!"); + } return back(); } @@ -168,10 +177,9 @@ class CustomerMailController extends Controller ->make(true); } - public function uploadAttachment($id){ - $fileRepo = new FileRepository(new CustomerFile()); + $fileRepo = new CustomerFileRepository(new CustomerFile()); if($id === 'tmp'){ $fileRepo->_set('disk', 'customer'); $fileRepo->_set('dir', '/attachment/'.date('Y/m').'/'); @@ -186,6 +194,124 @@ class CustomerMailController extends Controller 'code' => 200 ], 200); } + + public function ajax(){ + $data = Request::all(); + $ret = ""; + $status = false; + if(Request::ajax()){ + if($data['action'] === 'toggle_important'){ + $customer_mail = CustomerMail::find($data['id']); + $customer_mail->important = ($customer_mail->important ? false : true); + $customer_mail->save(); + $status = 'success'; + } + } + return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]); + } + + private function getSearchRequests() + { + if (!Request::get('booking_id')) { + return false; + } + + $query = CustomerMail::where('booking_id', '=', Request::get('booking_id')); + if (Request::get('customer_mail_dir') == 11) { //draft + $query->where('draft', '=', true); + }else{ + $query->where('dir', '=', Request::get('customer_mail_dir')); //with('lead' + + } + if (Request::get('customer_mail_country')) { + $query->where('travel_country_id', '=', Request::get('customer_mail_country')); + } + return $query; + } + + public function getRequests(){ + + $query = $this->getSearchRequests(); + return \DataTables::eloquent($query) + ->addColumn('checkbox', function (CustomerMail $customer_mail) { + return '
+ +
'; + }) + ->addColumn('important', function (CustomerMail $customer_mail) { + $icon = ($customer_mail->important ? 'ion-md-star' : 'ion-md-star-outline'); + return ''; + }) + ->addColumn('subject', function (CustomerMail $customer_mail) { + + $icon = $customer_mail->reply_id ? 'ion-ios-redo' : 'ion-ios-mail'; + $badge = $customer_mail->is_answer ? 'badge-next' : 'badge-secondary'; + $badge = $customer_mail->draft ? 'badge-default' : $badge; + $to_icon = $customer_mail->draft ? '' : ''; + $action = $customer_mail->draft ? 'edit-customer-mail' : 'show-customer-mail'; + $id = $customer_mail->draft ? $customer_mail->id : 'new'; + $url = $customer_mail->draft ? route('customer_mail_send_mail') : ''; + + return ' + '.$to_icon.''.$customer_mail->subject.' + '.($customer_mail->customer_files->count() ? '  '.$customer_mail->customer_files->count().'' : ''); + + }) + ->addColumn('date', function (CustomerMail $customer_mail) { + if($customer_mail->send){ + return ' '.$customer_mail->sent_at.''; + } + return ' '.$customer_mail->sent_at.''; + }) + ->addColumn('action', function (CustomerMail $customer_mail) { + $ret = ''; + if(!$customer_mail->draft){ + $ret = ' + + +   + + + +  '; + } + $ret .= ''; + return '
'.$ret.'
'; + }) + /* ->filter(function ($query) { + if (request()->has('search.value')) { + $query->where('subject', 'like', "%" . request('search.value') . "%"); + } + if (request()->has('data_table_search')) { + $query->where('subject', 'like', "%" . request('data_table_search') . "%"); + } + + })*/ + /*->filterColumn('subject', function($query, $keyword) { + if($keyword != ""){ + $query->whereRaw("subject LIKE ?", '%'.$keyword.'%'); + + } + })*/ + ->orderColumn('date', 'sent_at $1') + ->orderColumn('subject', 'subject $1') + ->orderColumn('important', 'important $1') + ->rawColumns(['checkbox', 'important', 'subject', 'date', 'action']) + ->make(true); + } } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index ee0bb93..06d75f4 100755 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -116,6 +116,10 @@ class HomeController extends Controller $booking_id = str_replace('drafts_edit_booking_', '', $show); return redirect(route('booking_detail', [$booking_id])); } + if(strpos($show, 'edit_booking_') !== false){ + $booking_id = str_replace('edit_booking_', '', $show); + return redirect(route('booking_detail', [$booking_id])); + } if($show == 'requests'){ return redirect(route('requests')); } diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index da0bc9a..5c0165c 100755 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -2,7 +2,9 @@ namespace App\Http\Controllers; +use App\Models\Airline; use App\Models\Booking; +use App\Models\CustomerMail; use App\Models\Status; use App\Models\Sym\TravelCountry; use App\Models\TravelAgenda; @@ -32,6 +34,8 @@ class RequestController extends Controller $filter_refund = Booking::$refund_types; $filter_xx_tkt = Booking::$xx_tkt_types; + $filter_airlines = Airline::get()->pluck('name', 'id')->toArray(); + unset($filter_paying_out[0]); unset($filter_refund[0]); unset($filter_xx_tkt[0]); @@ -44,6 +48,7 @@ class RequestController extends Controller 'filter_paying_out_status' => $filter_paying_out_status, 'filter_refund' => $filter_refund, 'filter_xx_tkt' => $filter_xx_tkt, + 'filter_airlines' => $filter_airlines, ]; return view('request.index', $data); } @@ -73,7 +78,7 @@ class RequestController extends Controller */ private function getSearchRequests(){ - $query = Booking::with('lead')->where('lead_id', '!=', NULL); + $query = Booking::with('lead')->with('customer_mails')->where('lead_id', '!=', NULL); if(Request::get('full_firstname_search') != ""){ $query->where('participant_firstname', 'LIKE', '%'.Request::get('full_firstname_search').'%'); @@ -109,6 +114,9 @@ class RequestController extends Controller if(Request::get('travel_option_xx_tkt') != ""){ $query->where('xx_tkt', '=', Request::get('travel_option_xx_tkt')); } + if(Request::get('travel_option_airline_id') != ""){ + $query->where('airline_id', '=', Request::get('travel_option_airline_id')); + } // $query->where('end_date', '<=', $now); @@ -218,7 +226,6 @@ class RequestController extends Controller return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id'); } - public function loadModal(){ $data = Request::all(); $ret = ""; @@ -227,11 +234,11 @@ class RequestController extends Controller $query = $this->getSearchRequests(); $bookings = $query->orderBy('id', 'DESC')->limit(50)->get(); foreach ($bookings as $booking){ - $tmp = ""; - $tmp .= $booking->customer ? $booking->customer->email." | " : "- | "; - $tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | "; - $tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | "; - $tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-"; + $tmp = []; + $tmp['email'] = $booking->customer ? $booking->customer->email : ""; + $tmp['name'] = $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | "; + $tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | "; + $tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-"; $data['customers'][$booking->id] = $tmp; } $ret = CustomerMailRepository::loadModal($data); @@ -294,22 +301,17 @@ class RequestController extends Controller $icon = ' '; } return ''.$icon.$booking->lead->status->name.''; - } return '-'; }) ->addColumn('last_customer_email', function (Booking $booking) { //umbuchen if($booking->customer_mails->count()){ - $customer_mail = $booking->customer_mails_sent_at->last(); - - return ''.$customer_mail->sent_at.''; - + return ''.$customer_mail->sent_at.''; } - return '-'; + return '-'; }) - ->addColumn('paying_out', function (Booking $booking) { $icon = ""; $badge = $booking->getPayingOutColor(); @@ -325,21 +327,33 @@ class RequestController extends Controller ->addColumn('paying_out_status', function (Booking $booking) { return ''.$booking->getPayingOutStatusType().''; }) - - + ->addColumn('airline_id', function (Booking $booking) { + return $booking->airline ? ''.$booking->airline->name.'' : '-'; + }) ->addColumn('refund', function (Booking $booking) { return ''.$booking->getRefundTypeList().''; }) + ->addColumn('hold', function (Booking $booking) { + return $booking->hold ? ' ' : ''; + }) ->addColumn('xx_tkt', function (Booking $booking) { return ''.$booking->getXxTktTypeList().''; }) - /* ->filterColumn('travel_country_id', function($query, $keyword) { - if($keyword != "") { - $query->whereRaw("travel_country_id = ?", $keyword); - } + ->orderColumn('last_customer_email', function ($query, $order) { - }) + $query->whereHas('customer_mails', + function ($q) use ($order) { + // $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //) + })->orderBy( + CustomerMail::select('sent_at') + ->whereColumn('booking_id', 'booking.id') + ->orderBy('sent_at', 'DESC') + ->limit(1) + , $order); + }) + + /* ->filterColumn('travelagenda_id', function($query, $keyword) { if($keyword != ""){ $query->whereRaw("travelagenda_id = ?", $keyword); @@ -359,9 +373,11 @@ class RequestController extends Controller ->orderColumn('paying_out', 'paying_out $1') ->orderColumn('paying_out_status', 'paying_out_status $1') ->orderColumn('refund', 'refund_date $1') + ->orderColumn('airline_id', 'airline_id $1') + ->orderColumn('hold', 'hold $1') ->orderColumn('xx_tkt', 'xx_tkt_date $1') ->orderColumn('travel_documents', 'travel_documents $1') - ->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'paying_out', 'paying_out_status', 'refund', 'xx_tkt']) + ->rawColumns(['action_lead_edit', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt']) ->make(true); } } diff --git a/app/Http/Controllers/Settings/AirlineController.php b/app/Http/Controllers/Settings/AirlineController.php new file mode 100755 index 0000000..2b13734 --- /dev/null +++ b/app/Http/Controllers/Settings/AirlineController.php @@ -0,0 +1,70 @@ +middleware('admin'); + + } + + public function index($step = false) + { + $data = [ + 'airline' => Airline::all(), + ]; + return view('settings.airline.index', $data); + } + + + public function update(){ + + $data = Request::all(); + if(isset($data['contact_emails'])){ + $data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails'])); + }else{ + $data['contact_emails'] = null; + } + if($data['id'] === "new"){ + $model = Airline::create($data); + }else{ + $model = Airline::find($data['id']); + $model->name = $data['name']; + $model->name_full = $data['name_full']; + $model->contact_emails = $data['contact_emails']; + $model->save(); + } + + \Session()->flash('alert-save', '1'); + return redirect(route('admin_settings_airline')); + } + + public function delete($id){ + //TODO check ist linked + /*if(Booking::where('travelagenda_id', $id)->count()){ + \Session()->flash('alert-error', 'Eintrag wird verwendet'); + return redirect()->back(); + }*/ + + $model = Airline::findOrFail($id); + + if(Booking::where('airline_id', $model->id)->count()){ + \Session()->flash('alert-error', 'Fehler: Airline in Buchnungen verwendet.'); + return redirect()->back(); + } + $model->delete(); + \Session()->flash('alert-success', 'Eintrag gelöscht'); + return redirect()->back(); + } + +} + + diff --git a/app/Http/Controllers/Settings/BookingStatusController.php b/app/Http/Controllers/Settings/BookingStatusController.php index 12bb0ab..ebd91f2 100755 --- a/app/Http/Controllers/Settings/BookingStatusController.php +++ b/app/Http/Controllers/Settings/BookingStatusController.php @@ -5,8 +5,6 @@ namespace App\Http\Controllers\Settings; use App\Http\Controllers\Controller; use App\Models\Status; -use App\Models\TravelNationality; -use App\Models\TravelNationalityRequirement; use Request; class BookingStatusController extends Controller diff --git a/app/Http/Controllers/Settings/KeywordController.php b/app/Http/Controllers/Settings/KeywordController.php index abdff88..831db94 100755 --- a/app/Http/Controllers/Settings/KeywordController.php +++ b/app/Http/Controllers/Settings/KeywordController.php @@ -4,9 +4,7 @@ namespace App\Http\Controllers\Settings; use App\Http\Controllers\Controller; -use App\Models\Booking; use App\Models\Keyword; -use App\Models\TravelAgenda; use Request; class KeywordController extends Controller diff --git a/app/Libraries/CouponPDF.php b/app/Libraries/CouponPDF.php new file mode 100644 index 0000000..b524dbf --- /dev/null +++ b/app/Libraries/CouponPDF.php @@ -0,0 +1,49 @@ +{$name} = $value; + } + + public function Header() + { + if($this->is_static_coupon){ + $file = './pdf/coupon/images/coupon-background.pdf'; + }else{ + $file = './pdf/coupon/images/coupon-background1.pdf'; + + } + + if (null === $this->_tplIdx) { + $this->setSourceFile($file); + $this->_tplIdx = $this->importPage(1); + } + $this->useTemplate($this->_tplIdx); + + } + + /*function Footer() { + $this->SetFont('Helvetica', '', 10); + + $this->SetXY(15, 260); + $this->Cell(180, 0, '', 'T'); + $this->Ln(); + $this->SetXY(15, 261); + + $this->MultiCell(180, 6, utf8_decode($this->_footer_data), 0, 'C'); + $this->Ln(); + + } // end of footer + */ + +} \ No newline at end of file diff --git a/app/Models/Airline.php b/app/Models/Airline.php new file mode 100644 index 0000000..4f0fd54 --- /dev/null +++ b/app/Models/Airline.php @@ -0,0 +1,56 @@ + 'array']; + + public function getContactEmailsStr($glue=PHP_EOL){ + if($this->contact_emails){ + return implode($glue, $this->contact_emails); + } + return ""; + } +} diff --git a/app/Models/Arrangement.php b/app/Models/Arrangement.php index 9d559b9..cda2ba6 100644 --- a/app/Models/Arrangement.php +++ b/app/Models/Arrangement.php @@ -7,7 +7,7 @@ namespace App\Models; use Carbon\Carbon; -use Reliese\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Model; /** * Class Arrangement diff --git a/app/Models/ArrangementTemplate.php b/app/Models/ArrangementTemplate.php index 755556f..f7cb593 100644 --- a/app/Models/ArrangementTemplate.php +++ b/app/Models/ArrangementTemplate.php @@ -7,7 +7,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Collection; -use Reliese\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Model; /** * Class ArrangementTemplate diff --git a/app/Models/ArrangementType.php b/app/Models/ArrangementType.php index e95f1d7..8c4f034 100644 --- a/app/Models/ArrangementType.php +++ b/app/Models/ArrangementType.php @@ -7,7 +7,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Collection; -use Reliese\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Model; /** * Class ArrangementType diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 3a2146e..cd3202e 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -8,7 +8,7 @@ namespace App\Models; use Carbon\Carbon; use Illuminate\Database\Eloquent\Collection; -use Reliese\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Model; /** * Class Booking @@ -116,6 +116,44 @@ use Reliese\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereWebsiteId($value) * @mixin \Eloquent * @property-read int|null $service_provider_entries_count + * @property float|null $canceled + * @property float|null $price_canceled + * @property int|null $paying_out + * @property int|null $paying_out_status + * @property int|null $airline_id + * @property int|null $refund + * @property \Illuminate\Support\Carbon|null $refund_date + * @property int|null $hold + * @property int|null $xx_tkt + * @property string|null $xx_tkt_date + * @property string|null $filekey + * @property-read \App\Models\Airline|null $airline + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails + * @property-read int|null $customer_mails_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CustomerMail[] $customer_mails_sent_at + * @property-read int|null $customer_mails_sent_at_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereAirlineId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereCanceled($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereFilekey($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereHold($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOut($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePayingOutStatus($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking wherePriceCanceled($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefund($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereRefundDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTkt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereXxTktDate($value) + * @property int|null $is_rail_fly + * @property string|null $notice + * @property-read \App\Models\CustomerMail $customer_mail_last + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereIsRailFly($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNotice($value) + * @property-read int|null $booking_applications_count + * @property-read int|null $booking_confirmations_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingStorno[] $booking_stornos + * @property-read int|null $booking_stornos_count + * @property-read int|null $booking_vouchers_count + * @property-read int|null $travel_insurances_count */ class Booking extends Model { @@ -144,6 +182,8 @@ class Booking extends Model 'final_payment' => 'float', 'travelagenda_id' => 'int', 'paying_out' => 'int', + 'hold' => 'int', + 'airline_id' => 'int', 'refund' => 'int', 'xx_tkt' => 'int', @@ -192,6 +232,8 @@ class Booking extends Model 'travelagenda_id', 'paying_out', 'paying_out_status', + 'airline_id', + 'hold', 'refund', 'refund_date', 'xx_tkt', @@ -225,7 +267,14 @@ class Booking extends Model 2 => 'erledigt', ]; - + public static $customer_mail_dirs = [ + 0 => ['name' => 'Reisender', 'icon'=>'ion-ios-filing'], + 1 => ['name' => 'Agentur', 'icon'=>'ion-ios-folder-open'], + 2 => ['name' => 'Flug', 'icon'=>'ion-ios-airplane'], + 3 => ['name' => 'Versicherung', 'icon'=>'ion-ios-help-buoy'], + 11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'], + 12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'], + ]; protected $paying_out_colors = [ 0 => '', 1 => 'info', @@ -252,6 +301,38 @@ class Booking extends Model 1 => 'danger', 2 => 'success', ]; + + /* + * + * @@ -303,7 +312,7 @@ -{{-- + {{--
  {{ __('zur Übersicht') }} @@ -321,7 +330,8 @@ @php($i = 1)
- +
+
@@ -449,217 +459,505 @@ {!! Form::close() !!} -
E-Mails
-
-
- +
- -
- @if($booking->customer_mails) -
-
+ +
+ +
-
- - - - {{-- --}} - - - - - +
+
+
+ -
- - - @foreach($booking->customer_mails as $customer_mail) - - - - {{-- --}} - - - - - - - @endforeach - -
 {{__('Mail-ID')}}{{__('E-Mail')}}{{__('Betreff')}}{{__('Anhang')}}{{__('gesendet')}}{{__('Gesendet')}}{{__('#')}}
- - - {{$customer_mail->id}} - {{ $customer_mail->email }} - @if($customer_mail->reply_id) - - @else - - @endif - {{ $customer_mail->subject }} - - {{ $customer_mail->customer_files->count() }} - @if($customer_mail->send) - - @else - - @endif - {{ $customer_mail->sent_at }} - - - - - -   - - - - - -
+ +
+ × +
- @endif +
+ + + + + @foreach($booking::$customer_mail_dirs as $dir_id => $customer_mail_dir) + + @php($badge = $dir_id === 0 ? "badge-primary" : "badge-outline-primary") + +
+ {{$customer_mail_dir['name']}} +
+
{{$booking->countCustomerMailsBy($dir_id)}}
+
+ @if($dir_id === 1 && $booking->travel_country) + @foreach($booking->travel_country->getCountryLands() as $id => $name) + +
+ {{$name}} +
+
{{$booking->countCustomerMailsBy($dir_id, $id)}}
+
+ @endforeach + @endif + @endforeach +
+ + + + +
+ +
+

+ +
  + Reisender +
+ +

+
+
+ + + +
+ +
+ +
+ + + + + + + + + {{-- --}} + + + + + + + + +
 {{__('E-Mail')}}{{__('Betreff')}}{{__('Datum')}}{{__('#')}}
+
+ +
+
+
+ -