08 2024
This commit is contained in:
parent
04d677d37a
commit
bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions
10
.env
10
.env
|
|
@ -16,12 +16,18 @@ APP_URL_CRM=my.
|
|||
APP_CONTACT_MAIL=kevin.adametz@me.com
|
||||
APP_CHECKOUT_MAIL=kevin.adametz@me.com
|
||||
APP_INFO_MAIL=kevin.adametz@me.com
|
||||
APP_PROORITY_MAIL=kevin.adametz@me.com
|
||||
APP_DEFAULT_MAIL=kevin.adametz@me.com
|
||||
APP_CHECKOUT_TEST_MAIL=kevin.adametz@me.com
|
||||
APP_INFO_TEST_MAIL=kevin.adametz@me.com
|
||||
EXCEPTION_MAIL=exception@adametz.media
|
||||
|
||||
APP_MAIN_TAX = 1.19
|
||||
APP_MAIN_TAX_RATE = 19
|
||||
APP_IPINFO=true
|
||||
|
||||
APP_MAIN_TAX=1.19
|
||||
APP_MAIN_TAX_RATE=19
|
||||
|
||||
APP_PHP_VERSION=7.4
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -76,7 +78,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -260,6 +261,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -282,7 +285,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -466,6 +468,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -488,7 +492,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -672,6 +675,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -694,7 +699,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -878,6 +882,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -900,7 +906,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1084,6 +1089,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -1106,7 +1113,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1290,6 +1296,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -1312,7 +1320,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1496,6 +1503,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -1518,7 +1527,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1702,6 +1710,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -1724,7 +1734,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1908,6 +1917,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -1930,7 +1941,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -2114,6 +2124,8 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::class,
|
||||
'JoeDixon\Translation\Drivers\Translation' => \JoeDixon\Translation\Drivers\File::class,
|
||||
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
|
||||
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
|
||||
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
|
||||
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
|
||||
|
|
@ -2136,7 +2148,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
|
|||
408
_ide_helper.php
408
_ide_helper.php
|
|
@ -1239,7 +1239,7 @@
|
|||
* Call the given Closure / class@method and inject its dependencies.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param \Illuminate\Container\array<string, mixed> $parameters
|
||||
* @param array<string, mixed> $parameters
|
||||
* @param string|null $defaultMethod
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
|
|
@ -17616,7 +17616,7 @@
|
|||
* @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
|
||||
* @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
|
||||
* @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.)
|
||||
* @method static static|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new Carbon object according to the specified format.
|
||||
* @method static static|false createFromFormat(string $format, string $time, DateTimeZone|string|false|null $timezone = null) Parse a string into a new Carbon object according to the specified format.
|
||||
* @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php
|
||||
*
|
||||
* </autodoc>
|
||||
|
|
@ -18150,6 +18150,16 @@
|
|||
*
|
||||
* @static
|
||||
*/
|
||||
public static function getShippingPrice()
|
||||
{
|
||||
/** @var \App\Services\Yard $instance */
|
||||
return $instance->getShippingPrice();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
public static function getYContent()
|
||||
{
|
||||
/** @var \App\Services\Yard $instance */
|
||||
|
|
@ -18234,6 +18244,16 @@
|
|||
{
|
||||
/** @var \App\Services\Yard $instance */
|
||||
return $instance->getShippingFree();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
public static function getShippingFreeMissingValue()
|
||||
{
|
||||
/** @var \App\Services\Yard $instance */
|
||||
return $instance->getShippingFreeMissingValue();
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
|
@ -19396,7 +19416,7 @@
|
|||
/**
|
||||
* Add metadata info
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, string> $info
|
||||
* @param array<string, string> $info
|
||||
* @return static
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19408,8 +19428,8 @@
|
|||
/**
|
||||
* Load a View and convert to HTML
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $data
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $mergeData
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $mergeData
|
||||
* @param string|null $encoding Not used yet
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19421,7 +19441,7 @@
|
|||
/**
|
||||
* Set/Change an option (or array of options) in Dompdf
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed>|string $attribute
|
||||
* @param array<string, mixed>|string $attribute
|
||||
* @param null|mixed $value
|
||||
* @return \Barryvdh\DomPDF\PDF
|
||||
* @static
|
||||
|
|
@ -19435,7 +19455,7 @@
|
|||
* Replace all the Options from DomPDF
|
||||
*
|
||||
* @deprecated Use setOption to override individual options.
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $options
|
||||
* @param array<string, mixed> $options
|
||||
* @static
|
||||
*/
|
||||
public static function setOptions($options)
|
||||
|
|
@ -19451,7 +19471,7 @@
|
|||
* 'compress' = > 1 or 0 - apply content stream compression, this is
|
||||
* on (1) by default
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, int> $options
|
||||
* @param array<string, int> $options
|
||||
* @return string The rendered PDF as string
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19568,7 +19588,7 @@
|
|||
/**
|
||||
* Add metadata info
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, string> $info
|
||||
* @param array<string, string> $info
|
||||
* @return static
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19580,8 +19600,8 @@
|
|||
/**
|
||||
* Load a View and convert to HTML
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $data
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $mergeData
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $mergeData
|
||||
* @param string|null $encoding Not used yet
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19593,7 +19613,7 @@
|
|||
/**
|
||||
* Set/Change an option (or array of options) in Dompdf
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed>|string $attribute
|
||||
* @param array<string, mixed>|string $attribute
|
||||
* @param null|mixed $value
|
||||
* @return \Barryvdh\DomPDF\PDF
|
||||
* @static
|
||||
|
|
@ -19607,7 +19627,7 @@
|
|||
* Replace all the Options from DomPDF
|
||||
*
|
||||
* @deprecated Use setOption to override individual options.
|
||||
* @param \Barryvdh\DomPDF\array<string, mixed> $options
|
||||
* @param array<string, mixed> $options
|
||||
* @static
|
||||
*/
|
||||
public static function setOptions($options)
|
||||
|
|
@ -19623,7 +19643,7 @@
|
|||
* 'compress' = > 1 or 0 - apply content stream compression, this is
|
||||
* on (1) by default
|
||||
*
|
||||
* @param \Barryvdh\DomPDF\array<string, int> $options
|
||||
* @param array<string, int> $options
|
||||
* @return string The rendered PDF as string
|
||||
* @static
|
||||
*/
|
||||
|
|
@ -19686,363 +19706,6 @@
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Gloudemans\Shoppingcart\Facades {
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Cart {
|
||||
/**
|
||||
* Set the current cart instance.
|
||||
*
|
||||
* @param string|null $instance
|
||||
* @return \Gloudemans\Shoppingcart\Cart
|
||||
* @static
|
||||
*/
|
||||
public static function instance($instance = null)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->instance($instance);
|
||||
}
|
||||
/**
|
||||
* Get the current cart instance.
|
||||
*
|
||||
* @return string
|
||||
* @static
|
||||
*/
|
||||
public static function currentInstance()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->currentInstance();
|
||||
}
|
||||
/**
|
||||
* Add an item to the cart.
|
||||
*
|
||||
* @param $id
|
||||
* @param $name
|
||||
* @param $qty
|
||||
* @param $price
|
||||
* @param $taxRate
|
||||
* @param $taxIncluded
|
||||
* @param array $options
|
||||
* @param array $eventOptions
|
||||
* @return array|array[]|\Gloudemans\Shoppingcart\CartItem|\Gloudemans\Shoppingcart\CartItem[]
|
||||
* @static
|
||||
*/
|
||||
public static function add($id, $name = null, $qty = null, $price = null, $taxRate = null, $taxIncluded = false, $options = [], $eventOptions = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->add($id, $name, $qty, $price, $taxRate, $taxIncluded, $options, $eventOptions);
|
||||
}
|
||||
/**
|
||||
* Update the cart item with the given rowId.
|
||||
*
|
||||
* @param $rowId
|
||||
* @param $qty
|
||||
* @param array $eventOptions
|
||||
* @return \Gloudemans\Shoppingcart\CartItem|void
|
||||
* @static
|
||||
*/
|
||||
public static function update($rowId, $qty, $eventOptions = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->update($rowId, $qty, $eventOptions);
|
||||
}
|
||||
/**
|
||||
* Remove the cart item with the given rowId from the cart.
|
||||
*
|
||||
* @param $rowId
|
||||
* @param array $eventOptions
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function remove($rowId, $eventOptions = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->remove($rowId, $eventOptions);
|
||||
}
|
||||
/**
|
||||
* Get a cart item from the cart by its rowId.
|
||||
*
|
||||
* @param string $rowId
|
||||
* @return \Gloudemans\Shoppingcart\CartItem
|
||||
* @static
|
||||
*/
|
||||
public static function get($rowId)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->get($rowId);
|
||||
}
|
||||
/**
|
||||
* Destroy the current cart instance.
|
||||
*
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function destroy()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->destroy();
|
||||
}
|
||||
/**
|
||||
* Get the content of the cart.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @static
|
||||
*/
|
||||
public static function content()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->content();
|
||||
}
|
||||
/**
|
||||
* Get the number of items in the cart.
|
||||
*
|
||||
* @return int|float
|
||||
* @static
|
||||
*/
|
||||
public static function count()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->count();
|
||||
}
|
||||
/**
|
||||
* Get the total price of the items in the cart.
|
||||
*
|
||||
* @param int $decimals
|
||||
* @param string $decimalPoint
|
||||
* @param string $thousandSeperator
|
||||
* @return string
|
||||
* @static
|
||||
*/
|
||||
public static function total($decimals = null, $decimalPoint = null, $thousandSeperator = null, $withFees = true)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->total($decimals, $decimalPoint, $thousandSeperator, $withFees);
|
||||
}
|
||||
/**
|
||||
* Get the total tax of the items in the cart.
|
||||
*
|
||||
* @param int $decimals
|
||||
* @param string $decimalPoint
|
||||
* @param string $thousandSeperator
|
||||
* @return float
|
||||
* @static
|
||||
*/
|
||||
public static function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null, $withFees = true)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->tax($decimals, $decimalPoint, $thousandSeperator, $withFees);
|
||||
}
|
||||
/**
|
||||
* Get the total tax of the items in the cart.
|
||||
*
|
||||
* @param int $decimals
|
||||
* @param string $decimalPoint
|
||||
* @param string $thousandSeperator
|
||||
* @return float
|
||||
* @static
|
||||
*/
|
||||
public static function feeTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->feeTax($decimals, $decimalPoint, $thousandSeperator);
|
||||
}
|
||||
/**
|
||||
* Get the subtotal (ex tax) of the items in the cart.
|
||||
*
|
||||
* @param int $decimals
|
||||
* @param string $decimalPoint
|
||||
* @param string $thousandSeperator
|
||||
* @return float
|
||||
* @static
|
||||
*/
|
||||
public static function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->subtotal($decimals, $decimalPoint, $thousandSeperator);
|
||||
}
|
||||
/**
|
||||
* Get the subtotal (total - tax) of the items in the cart.
|
||||
*
|
||||
* @param int $decimals
|
||||
* @param string $decimalPoint
|
||||
* @param string $thousandSeperator
|
||||
* @return float
|
||||
* @static
|
||||
*/
|
||||
public static function subtotalTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->subtotalTax($decimals, $decimalPoint, $thousandSeperator);
|
||||
}
|
||||
/**
|
||||
* Search the cart content for a cart item matching the given search closure.
|
||||
*
|
||||
* @param \Closure $search
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @static
|
||||
*/
|
||||
public static function search($search)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->search($search);
|
||||
}
|
||||
/**
|
||||
* Associate the cart item with the given rowId with the given model.
|
||||
*
|
||||
* @param string $rowId
|
||||
* @param mixed $model
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function associate($rowId, $model)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->associate($rowId, $model);
|
||||
}
|
||||
/**
|
||||
* Set the tax rate for the cart item with the given rowId.
|
||||
*
|
||||
* @param string $rowId
|
||||
* @param int|float $taxRate
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function setTax($rowId, $taxRate)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->setTax($rowId, $taxRate);
|
||||
}
|
||||
/**
|
||||
* Store an the current instance of the cart.
|
||||
*
|
||||
* @param $identifier
|
||||
* @param array $eventOptions
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function store($identifier, $eventOptions = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->store($identifier, $eventOptions);
|
||||
}
|
||||
/**
|
||||
* Restore the cart with the given identifier.
|
||||
*
|
||||
* @param $identifier
|
||||
* @param array $eventOptions
|
||||
* @return void
|
||||
* @static
|
||||
*/
|
||||
public static function restore($identifier, $eventOptions = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
$instance->restore($identifier, $eventOptions);
|
||||
}
|
||||
/**
|
||||
* Gets a specific fee from the fees array.
|
||||
*
|
||||
* @param $name
|
||||
* @return mixed
|
||||
* @static
|
||||
*/
|
||||
public static function getFee($name)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->getFee($name);
|
||||
}
|
||||
/**
|
||||
* Allows to charge for additional fees that may or may not be taxable
|
||||
* ex - service fee , delivery fee, tips.
|
||||
*
|
||||
* Because it uses ->put, the name must be unique otherwise will be overwritten.
|
||||
*
|
||||
* @param $name
|
||||
* @param $amount
|
||||
* @param $taxRate
|
||||
* @param array $options
|
||||
* @static
|
||||
*/
|
||||
public static function addFee($name, $amount, $taxRate = null, $options = [])
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->addFee($name, $amount, $taxRate, $options);
|
||||
}
|
||||
/**
|
||||
* Removes a fee from the fee array.
|
||||
*
|
||||
* @todo test to see if i need to restore this
|
||||
* @param $name
|
||||
* @static
|
||||
*/
|
||||
public static function removeFee($name)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->removeFee($name);
|
||||
}
|
||||
/**
|
||||
* Removes all the fees set in the cart.
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
public static function removeFees()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->removeFees();
|
||||
}
|
||||
/**
|
||||
* Gets all the fee totals.
|
||||
*
|
||||
* @param bool $format
|
||||
* @param bool $withTax
|
||||
* @return string
|
||||
* @static
|
||||
*/
|
||||
public static function feeTotal($decimals = null, $decimalPoint = null, $thousandSeperator = null, $withTax = true)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->feeTotal($decimals, $decimalPoint, $thousandSeperator, $withTax);
|
||||
}
|
||||
/**
|
||||
* Gets all the fees on the cart object.
|
||||
*
|
||||
* @return mixed
|
||||
* @static
|
||||
*/
|
||||
public static function getFees()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->getFees();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @static
|
||||
*/
|
||||
public static function toArray()
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->toArray();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param $array
|
||||
* @return \Gloudemans\Shoppingcart\Cart
|
||||
* @static
|
||||
*/
|
||||
public static function fromArray($array)
|
||||
{
|
||||
/** @var \Gloudemans\Shoppingcart\Cart $instance */
|
||||
return $instance->fromArray($array);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Facade\Ignition\Facades {
|
||||
|
|
@ -24142,10 +23805,11 @@ namespace {
|
|||
class DataTables extends \Yajra\DataTables\Facades\DataTables {}
|
||||
class Yard extends \App\Services\Facade\Yard {}
|
||||
class Debugbar extends \Barryvdh\Debugbar\Facades\Debugbar {}
|
||||
class Pdf extends \Barryvdh\DomPDF\Facade\Pdf {}
|
||||
class PDF extends \Barryvdh\DomPDF\Facade\Pdf {}
|
||||
class Cart extends \Gloudemans\Shoppingcart\Facades\Cart {}
|
||||
class Flare extends \Facade\Ignition\Facades\Flare {}
|
||||
class Flash extends \Laracasts\Flash\Flash {}
|
||||
class Html extends \Collective\Html\HtmlFacade {}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
159
app/Console/Commands/UserCleanUp.php
Normal file
159
app/Console/Commands/UserCleanUp.php
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Services\UserUtil;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
||||
class UserCleanUp extends Command
|
||||
{
|
||||
/**
|
||||
* ln -sfv /usr/bin/php73 /usr/bin/php
|
||||
* php74 artisan user:cleanup
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'user:cleanup';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'User Clean Up inactive for Business Structur and UserDetails';
|
||||
private $timeStart;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->info('RUN Command user:cleanup');
|
||||
|
||||
$this->timeStart = microtime(true);
|
||||
|
||||
$this->deleteInavtiveUsers();
|
||||
//alle inaktive User werden deaktivert, die childs werden dem nächsten aktiven Berater (parent) zugewiesen.
|
||||
$this->cleanUpInActiveUser();
|
||||
|
||||
return 0;
|
||||
|
||||
//\Log::info('Cron is running');
|
||||
//return 0;
|
||||
}
|
||||
|
||||
//gibt es gelöschte Berater mit Kunden und childs???
|
||||
|
||||
private function deleteInavtiveUsers(){
|
||||
|
||||
$this->info('START Command deleteInavtiveUsers');
|
||||
$count = 0;
|
||||
|
||||
$date = Carbon::now()->modify('-2 month');
|
||||
$delete_users = User::where('admin', 0)->where('payment_account', '<', $date)->get();
|
||||
|
||||
foreach($delete_users as $delete_user){
|
||||
/*
|
||||
dump('delete_users ---------- ');
|
||||
dump($delete_user->id);
|
||||
dump($delete_user->email);
|
||||
*/
|
||||
//finde nächsten aktiven Sponsor $delete_user->id kann sponsor oder pre sponsor sein
|
||||
$active_sponsor = UserUtil::findNextActiveSponsor($delete_user->id);
|
||||
if($active_sponsor){
|
||||
//setze alle Berater vom Sponsor für alle childs
|
||||
UserUtil::setNewSponsorToChilds($delete_user->id, $active_sponsor->id);
|
||||
UserUtil::setShoppingUserToNewMember($delete_user->id, $active_sponsor->id);
|
||||
}else{
|
||||
\Log::channel('cleanup')->error('deleteInavtiveUsers find no active_sponsor by delete_user_id:'.$delete_user->id);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
dump('findNextActiveSponsor');
|
||||
dump($active_sponsor->email);
|
||||
*/
|
||||
//make User to an Client from sponsor and delete User
|
||||
UserUtil::setUserToClient($delete_user->id, $active_sponsor->id);
|
||||
|
||||
$data = [
|
||||
'user_id' => $delete_user->id,
|
||||
'email' => $delete_user->email,
|
||||
'm_account' => $delete_user->account ? $delete_user->account->m_account : '',
|
||||
'm_first_name' => $delete_user->account ? $delete_user->account->m_first_name : '',
|
||||
'm_last_name' => $delete_user->account ? $delete_user->account->m_last_name : '',
|
||||
];
|
||||
$count ++;
|
||||
\Log::channel('cleanup')->info('deleteUser: '.json_encode($data));
|
||||
UserUtil::deleteUser($delete_user);
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command deleteInavtiveUsers: '.$count. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
}
|
||||
|
||||
private function cleanUpInActiveUser(){
|
||||
|
||||
$this->info('START Command cleanUpInActiveUser');
|
||||
$count = 0;
|
||||
|
||||
//clean up user where inactive since 2 weeks
|
||||
$date = Carbon::now()->modify('-2 weeks');
|
||||
|
||||
$inactive_users = User::where('active', true)->where('m_sponsor', '!=', null)->where('payment_account', '<', $date)->get();
|
||||
foreach($inactive_users as $inactive_user){
|
||||
/*
|
||||
dump('inactive_user ---------- ');
|
||||
dump($inactive_user->id);
|
||||
dump($inactive_user->email);
|
||||
*/
|
||||
$active_sponsor = UserUtil::findNextActiveSponsor($inactive_user->m_sponsor);
|
||||
if($active_sponsor){
|
||||
UserUtil::setNewSponsorToChilds($inactive_user->id, $active_sponsor->id);
|
||||
}else{
|
||||
\Log::channel('cleanup')->error('cleanUpInActiveUser find no active_sponsor by inactive_user:'.$inactive_user->id);
|
||||
}
|
||||
/*
|
||||
dump('findNextActiveSponsor');
|
||||
dump($active_sponsor->email);
|
||||
*/
|
||||
$data = [
|
||||
'user_id' => $inactive_user->id,
|
||||
'email' => $inactive_user->email,
|
||||
'm_account' => $inactive_user->account ? $inactive_user->account->m_account : '',
|
||||
'm_first_name' => $inactive_user->account ? $inactive_user->account->m_first_name : '',
|
||||
'm_last_name' => $inactive_user->account ? $inactive_user->account->m_last_name : '',
|
||||
];
|
||||
$count ++;
|
||||
|
||||
\Log::channel('cleanup')->info('inactive_user: '.json_encode($data));
|
||||
UserUtil::deactiveUser($inactive_user);
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command cleanUpInActiveUser: '.$count. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
}
|
||||
}
|
||||
112
app/Console/Commands/UserRestore.php
Normal file
112
app/Console/Commands/UserRestore.php
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Services\UserUtil;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
||||
class UserRestore extends Command
|
||||
{
|
||||
/**
|
||||
* ln -sfv /usr/bin/php73 /usr/bin/php
|
||||
* php artisan business:store month year
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'user:restore {user_id}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'User Restore active User where inactive for Business Structur and UserDetails';
|
||||
private $timeStart;
|
||||
private $user_id;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->info('RUN Command user:restore');
|
||||
|
||||
$this->timeStart = microtime(true);
|
||||
|
||||
$this->restoreInavtiveUsers();
|
||||
return 0;
|
||||
|
||||
//\Log::info('Cron is running');
|
||||
//return 0;
|
||||
}
|
||||
|
||||
//gibt es gelöschte Berater mit Kunden und childs???
|
||||
|
||||
private function restoreInavtiveUsers(){
|
||||
|
||||
$this->info('START Command restoreInavtiveUsers');
|
||||
$count = 0;
|
||||
|
||||
$this->user_id = $this->argument('user_id');
|
||||
|
||||
if(!$this->user_id){
|
||||
$this->info('NO user_id as argument');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info('RUN Command restoreInavtiveUsers on user_id: '.$this->user_id);
|
||||
|
||||
$user = User::find($this->user_id);
|
||||
|
||||
if(!$user){
|
||||
$this->info('restoreInavtiveUsers find no user by user_id:'.$this->user_id);
|
||||
\Log::channel('cleanup')->error('restoreInavtiveUsers find no user by user_id:'.$this->user_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user_id' => $user->id,
|
||||
'email' => $user->email,
|
||||
'm_account' => $user->account ? $user->account->m_account : '',
|
||||
'm_first_name' => $user->account ? $user->account->m_first_name : '',
|
||||
'm_last_name' => $user->account ? $user->account->m_last_name : '',
|
||||
];
|
||||
\Log::channel('cleanup')->info('reactiveUser: '.json_encode($data));
|
||||
|
||||
UserUtil::reactiveUser($user);
|
||||
//childs wieder herstellen
|
||||
UserUtil::resetChildsToSponsor($user->id);
|
||||
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command deleteInavtiveUsers: '.$count. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//497
|
||||
|
||||
//489 -> de
|
||||
|
||||
//478 new
|
||||
|
|
@ -63,6 +63,6 @@ class UserLevelUpdate
|
|||
}else{
|
||||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
Mail::to($email)->bcc($bcc)->send(new MailUserLevelUpdate($tp, $to));
|
||||
Mail::to($email)->bcc($bcc)->locale($user->getLocale())->send(new MailUserLevelUpdate($tp, $to));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ class UserPaymentCredits
|
|||
|
||||
public function addUserCreditItem($userBusiness)
|
||||
{
|
||||
$date = HTMLHelper::getMonth($userBusiness->month).' '.$userBusiness->year;
|
||||
//HTMLHelper::getMonth($userBusiness->month)
|
||||
|
||||
$date = $userBusiness->month.'#'.$userBusiness->year;
|
||||
|
||||
if($userBusiness->commission_shop_sales > 0){
|
||||
if($this->hasNotUserCreditItem($userBusiness, 1)){
|
||||
|
|
@ -41,7 +43,9 @@ class UserPaymentCredits
|
|||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_shop_sales,
|
||||
'message' => 'Provision Shop '.$date,
|
||||
'message' => 'payment.commission_shop#'.$date,
|
||||
'from_month' => $userBusiness->month,
|
||||
'from_year' => $userBusiness->year,
|
||||
'status' => 1,
|
||||
]);
|
||||
}
|
||||
|
|
@ -52,7 +56,9 @@ class UserPaymentCredits
|
|||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_pp_total,
|
||||
'message' => 'Provision Payline '.$date,
|
||||
'message' => 'payment.commission_payline#'.$date,
|
||||
'from_month' => $userBusiness->month,
|
||||
'from_year' => $userBusiness->year,
|
||||
'status' => 2,
|
||||
]);
|
||||
}
|
||||
|
|
@ -63,7 +69,9 @@ class UserPaymentCredits
|
|||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_growth_total,
|
||||
'message' => 'Provision Wachstumsbonus '.$date,
|
||||
'message' => 'payment.commission_growth_bonus#'.$date,
|
||||
'from_month' => $userBusiness->month,
|
||||
'from_year' => $userBusiness->year,
|
||||
'status' => 5,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@
|
|||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Symfony\Component\ErrorHandler\Exception\FlattenException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
|
@ -36,6 +40,10 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
|
||||
if ($this->shouldReport($exception)) {
|
||||
$this->sendEmail($exception);
|
||||
}
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
|
|
@ -52,4 +60,23 @@ class Handler extends ExceptionHandler
|
|||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
public function sendEmail(Throwable $exception)
|
||||
{
|
||||
try {
|
||||
$e = FlattenException::create($exception);
|
||||
$handler = new HtmlErrorRenderer(true); // boolean, true raises debug flag...
|
||||
$css = $handler->getStylesheet();
|
||||
$content = $handler->getBody($e);
|
||||
//Mail::to(config('app.exception_mail'))->send(new MailContact($contact));
|
||||
\Mail::send('emails.exception', compact('css','content'), function ($message) {
|
||||
$message
|
||||
->to(config('app.exception_mail'))
|
||||
->subject('mivita Exception: ' . \Request::fullUrl())
|
||||
;
|
||||
});
|
||||
} catch (Throwable $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
app/Exports/xExport.php
Normal file
33
app/Exports/xExport.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class xExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $collection;
|
||||
protected $headings;
|
||||
|
||||
use Exportable;
|
||||
|
||||
|
||||
public function __construct($data,$header)
|
||||
{
|
||||
$this->collection = $data;
|
||||
$this->headings = $header;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->collection);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [$this->headings];
|
||||
}
|
||||
|
||||
}
|
||||
188
app/Http/Controllers/Admin/DownloadController.php
Normal file
188
app/Http/Controllers/Admin/DownloadController.php
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
|
||||
|
||||
use Util;
|
||||
use Response;
|
||||
use Request;
|
||||
use App\Models\DcTag;
|
||||
use App\Models\DcFile;
|
||||
use App\Models\DcCategory;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\DC\TagRepository;
|
||||
use App\Repositories\DC\FileRepository;
|
||||
|
||||
class DownloadController extends Controller
|
||||
{
|
||||
protected $tagRepository;
|
||||
protected $fileRepository;
|
||||
|
||||
public function __construct(TagRepository $tagRepository, FileRepository $fileRepository)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->tagRepository = $tagRepository;
|
||||
$this->fileRepository = $fileRepository;
|
||||
}
|
||||
|
||||
public function files(){
|
||||
$q = DcFile::orderBy('id', 'desc')->get(); //File::all();
|
||||
$data = [
|
||||
'files' => $q,
|
||||
];
|
||||
return view('admin.downloadcenter.files', $data);
|
||||
}
|
||||
|
||||
public function fileEdit($id = null){
|
||||
$file = $id ? DcFile::find($id) : new DcFile;
|
||||
$data = [
|
||||
'file' => $file,
|
||||
'categories' => DcCategory::where('active', true)->orderBy('pos')->get(),
|
||||
'tags' => DcTag::orderBy('pos')->get(),
|
||||
];
|
||||
return view('admin.downloadcenter.file_edit', $data);
|
||||
}
|
||||
|
||||
public function fileUpdate($do, $id){
|
||||
|
||||
if($do === 'make_thumb'){
|
||||
$this->fileRepository->makeThumb($id);
|
||||
\Session()->flash('alert-success', 'Vorschaubild erstellt!');
|
||||
return back();
|
||||
}
|
||||
if($do === 'delete'){
|
||||
$this->fileRepository->deleteFile($id);
|
||||
\Session()->flash('alert-success', 'Datei gelöscht!');
|
||||
return redirect(route('admin_downloadcenter_files'));
|
||||
}
|
||||
if($do === 'delete_thumb'){
|
||||
$this->fileRepository->deleteThumb($id);
|
||||
\Session()->flash('alert-success', 'Vorschaubild gelöscht!');
|
||||
return back();
|
||||
}
|
||||
if($do === 'deactivate'){
|
||||
$file = DcFile::findOrFail($id);
|
||||
$file->active = false;
|
||||
$file->save();
|
||||
\Session()->flash('alert-success', 'Datei nicht anzeigen!');
|
||||
return back();
|
||||
}
|
||||
|
||||
if($do === 'activate'){
|
||||
$file = DcFile::findOrFail($id);
|
||||
$file->active = true;
|
||||
$file->save();
|
||||
\Session()->flash('alert-success', 'Datei wird angezeigt!');
|
||||
return back();
|
||||
}
|
||||
if($do === 'file_tags_update'){
|
||||
$file = DcFile::findOrFail($id);
|
||||
$this->fileRepository->tagsUpdate($id, Request::get('nestable_check'));
|
||||
\Session()->flash('alert-success', 'Tags aktualisiert!');
|
||||
return back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function upload(){
|
||||
return view('admin.downloadcenter.file_upload');
|
||||
}
|
||||
|
||||
public function uploadFile(){
|
||||
$data = Request::all();
|
||||
$file = $this->fileRepository->uploadFile($data);
|
||||
|
||||
return Response::json([
|
||||
'error' => false,
|
||||
'filename' => $file->filename,
|
||||
'filedata' => '',
|
||||
'code' => 200
|
||||
], 200);
|
||||
|
||||
//return response()->json(['success'=>basename($file)]);
|
||||
}
|
||||
|
||||
public function tags($flash = false){
|
||||
|
||||
$active = DcCategory::orderBy('pos')->get();
|
||||
$inactive = DcTag::where('category_id', null)->get();
|
||||
$data = [
|
||||
'category_active' => $active,
|
||||
'tags_inactive' => $inactive,
|
||||
];
|
||||
if($flash){
|
||||
\Session()->flash('alert-success', 'gespeichert!');
|
||||
}
|
||||
return view('admin.downloadcenter.tags', $data);
|
||||
}
|
||||
|
||||
public function storeItem($obj = false){
|
||||
$data = Request::all();
|
||||
return $this->tagRepository->storeItem($obj, $data);
|
||||
return redirect(route('admin_downloadcenter_tags'));
|
||||
}
|
||||
|
||||
|
||||
public function deleteItem($obj, $id){
|
||||
$this->tagRepository->deleteItem($obj, $id);
|
||||
return redirect(route('admin_downloadcenter_tags'));
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$query = DcFile::with('tags')->select('dc_files.*');
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (DcFile $file) {
|
||||
return '<a href="'.route('admin_downloadcenter_file_edit', [$file->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('image', function (DcFile $file) {
|
||||
return ($file->hasThumb() && $file->hasBig()) ?
|
||||
'<img src="' .route('storage_file', [$file->id, 'dc_thumb', 'image']) . '" class="img-fluid img-responsive" style="max-width: 100px;">' :
|
||||
'<a href="'.route('admin_downloadcenter_file', ['make_thumb', $file->id]).'" class="btn btn-sm btn-warning"> Vorschaubild<br>erstellen <i class="ion ion-md-refresh-circle"></i></a>';
|
||||
})
|
||||
->addColumn('name', function (DcFile $file) {
|
||||
//Storage::disk('local')->url($file->filename) }}
|
||||
return '<a target="_blank" href="'.route('storage_file', [$file->id, 'dc_file', 'stream']).'">'.$file->original_name.'</a>';
|
||||
// return '<a target="_blank" href="">'.$file->original_name.'</a>';
|
||||
})
|
||||
->addColumn('category', function (DcFile $file) {
|
||||
//return $file->category ? $file->category->name : '';
|
||||
})
|
||||
->addColumn('tags', function (DcFile $file) {
|
||||
//return $file->hasTags() ? '<span class="badge badge-pill badge-success">('.$file->fileTag()->count().')</span>' : '<span class="badge badge-pill badge-dange">X</span>';
|
||||
return $file->tags->implode('name', '<br>');
|
||||
})
|
||||
->addColumn('size', function (DcFile $file) {
|
||||
return Util::formatBytes($file->size);
|
||||
})
|
||||
->addColumn('active', function (DcFile $file) {
|
||||
return get_active_badge($file->active);
|
||||
//return $file->active ? '<span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> aktiv</span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times-circle"></i> inaktiv</span>';
|
||||
})
|
||||
->addColumn('created_at', function (DcFile $file) {
|
||||
return $file->created_at->format('d.m.Y H:i');
|
||||
})
|
||||
->addColumn('updated_at', function (DcFile $file) {
|
||||
return $file->updated_at->format('d.m.Y');
|
||||
})
|
||||
->addColumn('action', function (DcFile $file) {
|
||||
return '<a onclick="return confirm(\'Diese Datei wirklich löschen?\');" class="btn btn-sm btn-danger" href="'.route('admin_downloadcenter_file', ['delete', $file->id]).'"><i class="fa fa-trash"></i></a>';
|
||||
})
|
||||
->filterColumn('name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('original_name', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('name', 'original_name $1')
|
||||
->orderColumn('original_name', 'original_name $1')
|
||||
->orderColumn('category', 'category $1')
|
||||
->orderColumn('size', 'size $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('created_at', 'created_at $1')
|
||||
->rawColumns(['id', 'image', 'name', 'active', 'tags', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
}
|
||||
467
app/Http/Controllers/Admin/PaymentSalesController.php
Normal file
467
app/Http/Controllers/Admin/PaymentSalesController.php
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Exports\xExport;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Exports\UserTeamExport;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\BusinessPlan\ExportBot;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class PaymentSalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
];
|
||||
return view('admin.payment.salesvolume', $data);
|
||||
}
|
||||
|
||||
|
||||
public function download(){
|
||||
|
||||
/*
|
||||
EXCEL EXPORT function */
|
||||
|
||||
/*
|
||||
if(Request::get('action') === "exportfull_paid"){
|
||||
return $this->exportFullList(1);
|
||||
}
|
||||
if(Request::get('action') === "exportfull_unpaid"){
|
||||
return $this->exportFullList(0);
|
||||
}
|
||||
*/
|
||||
if(Request::get('action') === "exportfull_paid_invoice"){
|
||||
return $this->exportFullListInvoice();
|
||||
}
|
||||
if(Request::get('action') === "export"){
|
||||
return $this->exportKompaktListInvoice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('payment_sales_vol_filter_month')){
|
||||
session(['payment_sales_vol_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('payment_sales_vol_filter_year')){
|
||||
session(['payment_sales_vol_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(Request::get('payment_sales_vol_filter_month')){
|
||||
session(['payment_sales_vol_filter_month' => Request::get('payment_sales_vol_filter_month')]);
|
||||
}
|
||||
if(Request::get('payment_sales_vol_filter_year')){
|
||||
session(['payment_sales_vol_filter_year' => Request::get('payment_sales_vol_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
private function exportKompaktListInvoice(){
|
||||
$objects = $this->initKompaktList();
|
||||
$columns = [];
|
||||
$filename = "mivita-absatzmengen-kompakt".session('payment_sales_vol_filter_month').'_'.session('payment_sales_vol_filter_year')."-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
'Artikelnummer',
|
||||
'Menge',
|
||||
|
||||
);
|
||||
if($objects){
|
||||
foreach ($objects as $key => $obj){
|
||||
$columns[] = array(
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
|
||||
|
||||
private function exportFullListInvoice(){
|
||||
|
||||
$this->setFilterVars();
|
||||
|
||||
$UserInvoices = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
|
||||
->where('user_invoices.month', '=', session('payment_sales_vol_filter_month'))
|
||||
->where('user_invoices.year', '=', session('payment_sales_vol_filter_year'))
|
||||
->get();
|
||||
|
||||
$headers = array('Rechnungsnummer','Datum', 'EMail', 'Zahlung', 'ProduktNummer', 'ProduktName', 'Anzahl', 'Summe', 'Kompensation');
|
||||
$columns = [];
|
||||
$hasSOID = [];
|
||||
$total_value = [];
|
||||
|
||||
foreach($UserInvoices as $UserInvoice){
|
||||
if($UserInvoice->shopping_order){
|
||||
$ShoppingOrder = $UserInvoice->shopping_order;
|
||||
$object = [];
|
||||
$object['Rechnungsnummer'] = $UserInvoice->full_number;
|
||||
$object['Datum'] = $UserInvoice->date;
|
||||
$object['EMail'] = $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_email : 'n/a';
|
||||
$object['Zahlung'] = $ShoppingOrder->getPaymentForType();
|
||||
|
||||
if($ShoppingOrder->payment_for === 5){ //homeparty
|
||||
if($ShoppingOrder->homeparty){
|
||||
foreach($ShoppingOrder->homeparty->homeparty_order_items as $homeparty_item){
|
||||
$total_value[$homeparty_item->product_id] = isset($total_value[$homeparty_item->product_id]) ? $total_value[$homeparty_item->product_id] + $homeparty_item->qty : $homeparty_item->qty;
|
||||
$object['ProduktNummer'] = $homeparty_item->product ? $homeparty_item->product->number : "n/a";
|
||||
$object['ProduktName'] = $homeparty_item->product ? $homeparty_item->product->name : "n/a";
|
||||
$object['Anzahl'] = $homeparty_item->qty;
|
||||
$object['Summe'] = $total_value[$homeparty_item->product_id];
|
||||
$object['Kompensation'] = '';
|
||||
$columns[] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
}elseif($ShoppingOrder->payment_for === 8){ //collective_invoice
|
||||
if($ShoppingOrder->shopping_collect_order){
|
||||
foreach($ShoppingOrder->shopping_collect_order->shop_items as $shop_item){
|
||||
$total_value[$shop_item['pid']] = isset($total_value[$shop_item['pid']]) ? $total_value[$shop_item['pid']] + $shop_item['qty'] : $shop_item['qty'];
|
||||
$object['ProduktNummer'] = $shop_item['number'];
|
||||
$object['ProduktName'] = $shop_item['name'];
|
||||
$object['Anzahl'] = $shop_item['qty'];
|
||||
$object['Summe'] = $total_value[$shop_item['pid']];
|
||||
$object['Kompensation'] = '';
|
||||
$columns[] = $object;
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
if($ShoppingOrder->shopping_order_items){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
$total_value[$shopping_order_item->product_id] = isset($total_value[$shopping_order_item->product_id]) ? $total_value[$shopping_order_item->product_id] + $shopping_order_item->qty : $shopping_order_item->qty;
|
||||
$object['ProduktNummer'] = $shopping_order_item->product ? $shopping_order_item->product->number : "n/a";
|
||||
$object['ProduktName'] = $shopping_order_item->product ? $shopping_order_item->product->name : "n/a";
|
||||
$object['Anzahl'] = $shopping_order_item->qty;
|
||||
$object['Summe'] = $total_value[$shopping_order_item->product_id];
|
||||
$object['Kompensation'] = ($shopping_order_item->comp ? $shopping_order_item->comp : '');
|
||||
|
||||
$columns[] = $object;
|
||||
}
|
||||
}
|
||||
}
|
||||
$hasSOID[] = $ShoppingOrder->id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$filename = "mivita-absatzmengen-voll-".session('payment_sales_vol_filter_month').'_'.session('payment_sales_vol_filter_year')."-export";
|
||||
return Excel::download(new xExport($columns, $headers), $filename.'.xls');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function initKompaktList()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$UserInvoices = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
|
||||
->where('user_invoices.month', '=', session('payment_sales_vol_filter_month'))
|
||||
->where('user_invoices.year', '=', session('payment_sales_vol_filter_year'))
|
||||
->get();
|
||||
|
||||
$objects = [];
|
||||
|
||||
foreach($UserInvoices as $UserInvoice){
|
||||
if($UserInvoice->shopping_order){
|
||||
$ShoppingOrder = $UserInvoice->shopping_order;
|
||||
|
||||
if($ShoppingOrder->payment_for === 5){ //homeparty
|
||||
if($ShoppingOrder->homeparty){
|
||||
foreach($ShoppingOrder->homeparty->homeparty_order_items as $homeparty_item){
|
||||
if(isset($objects[$homeparty_item->product_id])){
|
||||
$value = intval($objects[$homeparty_item->product_id]['value'] + $homeparty_item->qty);
|
||||
$objects[$homeparty_item->product_id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$homeparty_item->product_id] = [
|
||||
'name' => $homeparty_item->product ? $homeparty_item->product->name : "n/a ".$homeparty_item->product_id,
|
||||
'number' => $homeparty_item->product ? $homeparty_item->product->number : "n/a ".$homeparty_item->product_id,
|
||||
'value' => $homeparty_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}elseif($ShoppingOrder->payment_for === 8){ //collective_invoice
|
||||
if($ShoppingOrder->shopping_collect_order){
|
||||
foreach($ShoppingOrder->shopping_collect_order->shop_items as $shop_item){
|
||||
|
||||
if(isset($objects[$shop_item['pid']])){
|
||||
$value = intval($objects[$shop_item['pid']]['value'] + $shop_item['qty']);
|
||||
$objects[$shop_item['pid']]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shop_item['pid']] = [
|
||||
'name' => $shop_item['name'],
|
||||
'number' => $shop_item['number'],
|
||||
'value' => $shop_item['qty']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($ShoppingOrder->shopping_order_items){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
if(isset($objects[$shopping_order_item->product_id])){
|
||||
$value = intval($objects[$shopping_order_item->product_id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product_id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product_id] = [
|
||||
'name' => $shopping_order_item->product ? $shopping_order_item->product->name : "n/a ".$shopping_order_item->product_id,
|
||||
'number' => $shopping_order_item->product ? $shopping_order_item->product->number : "n/a ".$shopping_order_item->product_id,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$hasSOID[] = $ShoppingOrder->id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $objects;
|
||||
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
|
||||
/*$collect = collect([
|
||||
['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
|
||||
['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
|
||||
['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
|
||||
]);*/
|
||||
$objects = $this->initKompaktList();
|
||||
$collection = collect();
|
||||
if($objects){
|
||||
foreach($objects as $key => $obj){
|
||||
$collection->push([
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return \DataTables::of($collection)->toJson();
|
||||
}
|
||||
|
||||
/*
|
||||
//Auswertung nach ShoppingOrder
|
||||
//nach Datum created_at wann die Bestellung erstellt wurde
|
||||
//Ist nicht das Datum der Rechnung, da hier teilweise die Sammelrechnungen oder Zahlungen erst in nächsten Monat erfolgen
|
||||
|
||||
|
||||
public function exportFullList($paid = 1){
|
||||
|
||||
|
||||
$date_start = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d H:i:s');
|
||||
$ShoppingOrders = ShoppingOrder::where('paid', $paid)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$txActions = ['prev' => 'keine Zahlung', 'appointed' => 'offen', 'failed' => 'abbruch', 'paid' => 'bezahlt'];
|
||||
$headers = array('ID', 'Zahlung', 'Datum', 'EMail', 'ProduktID', 'ProduktNummer', 'ProduktName', 'Anzahl', 'Notiz', 'Gesamt');
|
||||
$objects = [];
|
||||
$columns = [];
|
||||
$hasSOID = [];
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
$value = "";
|
||||
if($shopping_order_item->product){
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
$value = $shopping_order_item->qty;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$object = [];
|
||||
if(in_array($ShoppingOrder->id, $hasSOID)){
|
||||
$object['ID'] = '';
|
||||
$object['EMail'] = '';
|
||||
$object['Zahlung'] = '';
|
||||
$object['Datum'] = '';
|
||||
}else{
|
||||
$object['ID'] = $ShoppingOrder->id;
|
||||
$object['EMail'] = $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_email : 'n/a';
|
||||
$object['Zahlung'] = isset($txActions[$ShoppingOrder->txaction]) ? $txActions[$ShoppingOrder->txaction] : $ShoppingOrder->txaction;
|
||||
$object['Datum'] = $ShoppingOrder->created_at->format('d.m.Y');
|
||||
}
|
||||
$object['ProduktID'] = $shopping_order_item->product_id;
|
||||
$object['ProduktNummer'] = $shopping_order_item->product ? $shopping_order_item->product->number : "n/a";
|
||||
$object['ProduktName'] = $shopping_order_item->product ? $shopping_order_item->product->name : "n/a";
|
||||
$object['Anzahl'] = $shopping_order_item->qty;
|
||||
$object['Notiz'] = ($shopping_order_item->comp ? 'Compensation '.$shopping_order_item->comp : '') . ($shopping_order_item->shopping_collect_order_id ? 'Sammelbestellung '.$shopping_order_item->shopping_collect_order_id : '');
|
||||
$object['Gesamt'] = $value;
|
||||
$columns[] = $object;
|
||||
|
||||
$hasSOID[] = $ShoppingOrder->id;
|
||||
}
|
||||
}
|
||||
if($paid){
|
||||
$filename = "mivita-absatzmengen-full-paid-".session('payment_sales_vol_filter_month').'_'.session('payment_sales_vol_filter_year')."-export";
|
||||
}else{
|
||||
$filename = "mivita-absatzmengen-full-unpaid-".session('payment_sales_vol_filter_month').'_'.session('payment_sales_vol_filter_year')."-export";
|
||||
}
|
||||
|
||||
return Excel::download(new xExport($columns, $headers), $filename.'.xls');
|
||||
|
||||
//CSV EXPORT function
|
||||
$headers = array(
|
||||
"Content-type" => "text/csv",
|
||||
"Content-Disposition" => "attachment; filename=$fileName",
|
||||
"Pragma" => "no-cache",
|
||||
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
|
||||
"Expires" => "0"
|
||||
);
|
||||
|
||||
$header = array('ID', 'Zahlung', 'Datum', 'EMail', 'ProduktID', 'ProduktNummer', 'ProduktName', 'Anzahl', 'Notiz', 'Gesamt');
|
||||
|
||||
$callback = function() use($columns, $header) {
|
||||
|
||||
$file = fopen('php://output', 'w');
|
||||
fputcsv($file, $header);
|
||||
$row = [];
|
||||
|
||||
foreach ($columns as $row) {
|
||||
fputcsv($file, $row);
|
||||
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
};
|
||||
|
||||
return response()->stream($callback, 200, $headers);
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
//alte Funktion auswerung nach ShoppingOrder
|
||||
private function testCheckFunction(){
|
||||
//$date_start = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->format('Y-m-d');
|
||||
//$date_end = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
|
||||
$date_start = Carbon::parse('01.01.2024')->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.01.2024')->endOfMonth()->format('Y-m-d H:i:s');
|
||||
dump($date_start);
|
||||
dump($date_end);
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if($shopping_order_item->product->id === 122){
|
||||
//dump($shopping_order_item->qty);
|
||||
//$counter += $shopping_order_item->qty;
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::whereProductId(122)->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
$counter += $ShoppingOrderItem->qty;
|
||||
dump($ShoppingOrderItem->id);
|
||||
}
|
||||
// dump($objects);
|
||||
dump($counter);
|
||||
dd("OKAY");
|
||||
}*/
|
||||
|
||||
/*
|
||||
// alte Funktion auswerung nach ShoppingOrder
|
||||
private function initSearch($returnColl = true)
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$date_start = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.'.session('payment_sales_vol_filter_month').'.'.session('payment_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d H:i:s');
|
||||
$ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product){
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($returnColl){
|
||||
$collection = collect();
|
||||
|
||||
foreach($objects as $key => $obj){
|
||||
$collection->push([
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
]);
|
||||
}
|
||||
return $collection;
|
||||
}
|
||||
return $objects;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
@ -4,18 +4,19 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Services\SysLog;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
|
||||
|
||||
use App\Services\SysLog;
|
||||
use App\Services\UserUtil;
|
||||
use App\Models\UserAccount;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Util;
|
||||
|
||||
class AdminUserController extends Controller
|
||||
{
|
||||
|
|
@ -74,7 +75,7 @@ class AdminUserController extends Controller
|
|||
SysLog::action('save-admin', 'admin_user', 3)
|
||||
->setUserId(Auth::user()->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setMessage('Set user admin value: '.HTMLHelper::getRoleLabel($user->admin))
|
||||
->setMessage('Set user admin value: '.HTMLHelper::getLabel($user->admin))
|
||||
->save();
|
||||
}
|
||||
|
||||
|
|
@ -125,8 +126,21 @@ class AdminUserController extends Controller
|
|||
$user->payment_account = null;
|
||||
}else{
|
||||
$user->wizard = 100;
|
||||
$user->payment_account = \Carbon::parse(str_replace("- ", "", $data['payment_account']));
|
||||
$payment_account = \Carbon::parse(str_replace("- ", "", $data['payment_account']));
|
||||
$user->payment_account = $payment_account;
|
||||
if($payment_account > Carbon::now()){
|
||||
if($user->active === 0){
|
||||
$user->active = true;
|
||||
UserUtil::reactiveUserResetChilds($user->id, 'on save-account AdminUserController');
|
||||
}
|
||||
}else{
|
||||
if($user->active === 1){
|
||||
$user->active = false;
|
||||
UserUtil::deactiveUserNewSponsorChilds($user->id, 'on save-account AdminUserController');
|
||||
}
|
||||
}
|
||||
}
|
||||
//th.schifferegger@gmail.com
|
||||
SysLog::action('save-account', 'admin_user', 3)
|
||||
->setUserId(Auth::user()->id)
|
||||
->setModel($user->id, User::class)
|
||||
|
|
@ -178,7 +192,7 @@ class AdminUserController extends Controller
|
|||
$user = User::findOrFail($user_id);
|
||||
$this->userRepo->deleteUser($user);
|
||||
|
||||
\Session()->flash('alert-success', "Kontakt gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.contact_delete'));
|
||||
return redirect('/admin/users');
|
||||
|
||||
}
|
||||
|
|
@ -192,4 +206,93 @@ class AdminUserController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 5);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-admin" data-id="'.$user->id.'" data-email="'.$user->email.'" data-admin="'.$user->admin.'">'.HTMLHelper::getRoleLabel($user->admin).'</a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
$date = $user->getConfirmationDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-confirmed" data-id="'.$user->id.'" data-email="'.$user->email.'" data-confirmed="'.$user->confirmed.'" data-confirmation_date="'.$date.'">';
|
||||
return $user->confirmed ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
$date = $user->getActiveDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-active" data-id="'.$user->id.'" data-email="'.$user->email.'" data-active="'.$user->active.'" data-active_date="'.$date.'">';
|
||||
return $user->active ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('account', function (User $user) {
|
||||
$date = $user->getPaymentAccountDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-account" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_account="'.$date.'">';
|
||||
if($user->payment_account){
|
||||
if($user->isActiveAccount()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('shop', function (User $user) {
|
||||
$date = $user->getPaymentShopDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-shop" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_shop="'.$date.'">';
|
||||
if($user->payment_shop){
|
||||
if($user->isActiveShop()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('since', function (User $user) {
|
||||
if($user->shop){
|
||||
if($user->shop->active){
|
||||
return $user->shop->getActiveDateFormatSmall();
|
||||
}
|
||||
return $user->shop->getActiveDateFormatSmall();
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('country', function (User $user) {
|
||||
return ($user->account && $user->account->country) ? $user->account->country->de : '';
|
||||
})
|
||||
->addColumn('my_payment_methods', function (User $user) {
|
||||
$payment_methods = json_encode($user->payment_methods);
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-payment_methods" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_methods="'.htmlspecialchars($payment_methods).'">';
|
||||
if(!$user->payment_methods){
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$user->getPaymentMethodsShort().'</span></a>';
|
||||
|
||||
})
|
||||
->addColumn('action_login', function (User $user) {
|
||||
return '<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a>';
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<a class="btn icon-btn btn-sm btn-danger" href="#" data-toggle="modal" data-target="#modals-user-delete" data-id="'.$user->id.'" data-email="'.$user->email.'"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->addColumn('test_mode', function (User $user) {
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-test_mode" data-id="'.$user->id.'" data-email="'.$user->email.'" data-test_mode="'.$user->test_mode.'">';
|
||||
return $user->test_mode ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('shop', 'shop $1')
|
||||
->orderColumn('admin', 'active $1')
|
||||
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_login', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ class KasController extends Controller
|
|||
|
||||
// Logindaten
|
||||
private $kas_user = 'w017f6e4'; // KAS-Logon
|
||||
private $kas_pass = '7mMJUF4YSVWNpp39'; // KAS-Passwort
|
||||
private $kas_pass = 'Medxiz-funteb-7dubdi'; // KAS-Passwort
|
||||
private $session_lifetime = 600; // Gültigkeit des Tokens in Sek. bis zur neuen Authentifizierung
|
||||
private $session_update_lifetime = 'Y'; // bei N läuft die Session nach <$session_lifetime> Sekunden ab, bei Y verlängert sich die Session mit jeder Benutzung
|
||||
private $CredentialToken = false;
|
||||
|
|
|
|||
|
|
@ -9,153 +9,92 @@ class KasSLLController extends Controller
|
|||
{
|
||||
|
||||
private static $ssl_certificate_sni_csr = "-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIIC0DCCAbgCAQAwgYoxCzAJBgNVBAYTAkRFMQ4wDAYDVQQRDAU4Nzc1NTEPMA0G
|
||||
MIIBfzCCASUCAQAwgYoxCzAJBgNVBAYTAkRFMQ4wDAYDVQQRDAU4Nzc1NTEPMA0G
|
||||
A1UECAwGQmF5ZXJuMRUwEwYDVQQHDAxLaXJjaGhhc2xhY2gxEzARBgNVBAkMCkxl
|
||||
aW5mZWxkIDIxFjAUBgNVBAoMDXJpd2EtdGVjIGUuSy4xFjAUBgNVBAMMDSoubWl2
|
||||
aXRhLmNhcmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVOhtOTJBn
|
||||
5V9SmHmo/EawNiO0VwHOVnnrfnaPD2A1DeKqHmAfMTaybHaCfi+mufV8veemfY1j
|
||||
6rXq7RFU46SMBbFlfZqKS/3zb2d3yRT7OBU83PV5P8JXHrqEArlmKiOZcPoj86TT
|
||||
Abq5wwxjFXkePzJSdOdUN/Z1E1tI8ieUQC40tpMsRvf5XOzQZousXBT1P6F9Q2Fb
|
||||
UKEfiEBJ0wjnz74a73U7DebuYGEFPSjVjrkVB11+55y1MBkwg/6JIro+BlXorW6X
|
||||
aifb1PKFbTFQnlC4BAKyPHxNKWZCSHgw/C3A7fBQKHM1wVhZo2BZrumdE+X1FOSc
|
||||
WlN+M/+TyUybAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEAJeDEZBjk9ITfZAzJ
|
||||
LMVIsu4Cuz2YZkZY8r+Wdd8E1k0lAdcht2xY/uL91NwXl/hUJiVo4uBUFnCogc/k
|
||||
dAxrRsrjiw8nHgfBgreGZj73S+tx00DUz1eP9uIVNzSO+aRMBHL8BvvLUR94KVSu
|
||||
aVhy8fJESdDiF5TwZR7jPIWoU0esI1cEebFG2kS/wTSuUWxLh1ZGGuEKFETfEpOK
|
||||
ooy0gUcHTP1NWo/vTDwdlf47t2vvZ/ZD0ursWXp6CNNZvwimHPxgSq8KKxLQyf5U
|
||||
S/UHogxC8PbOzTJI0DutkCZO0iUO8gTq0GXZHVqkqTCixfIFeuMuL0ZvXYJVhZXP
|
||||
4CBn5g==
|
||||
aXRhLmNhcmUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATHOCZrM/6Ry1iMHtpL
|
||||
3OM+nm2NZJwbT91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZ
|
||||
Rg0FoDgwNgYJKoZIhvcNAQkOMSkwJzAlBgNVHREEHjAcgg0qLm1pdml0YS5jYXJl
|
||||
ggttaXZpdGEuY2FyZTAKBggqhkjOPQQDBANIADBFAiEAva2vcfT1l/NvrMdFrujf
|
||||
pFrbXTZMecYsa9SDnHXhp1gCIG8BFZSN/mPjM3EZXunj4bb1AXqqdxe+VjPiw6VL
|
||||
lZwE
|
||||
-----END CERTIFICATE REQUEST-----";
|
||||
private static $ssl_certificate_sni_key = "-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVOhtOTJBn5V9S
|
||||
mHmo/EawNiO0VwHOVnnrfnaPD2A1DeKqHmAfMTaybHaCfi+mufV8veemfY1j6rXq
|
||||
7RFU46SMBbFlfZqKS/3zb2d3yRT7OBU83PV5P8JXHrqEArlmKiOZcPoj86TTAbq5
|
||||
wwxjFXkePzJSdOdUN/Z1E1tI8ieUQC40tpMsRvf5XOzQZousXBT1P6F9Q2FbUKEf
|
||||
iEBJ0wjnz74a73U7DebuYGEFPSjVjrkVB11+55y1MBkwg/6JIro+BlXorW6Xaifb
|
||||
1PKFbTFQnlC4BAKyPHxNKWZCSHgw/C3A7fBQKHM1wVhZo2BZrumdE+X1FOScWlN+
|
||||
M/+TyUybAgMBAAECggEAJ0hYj9AP44m6AiApRpbCdPiLhZmx3ANfrOJpi1dc2BqD
|
||||
pIzCePOXlnh+6fMV0Cn7uY60QFuksLzEjsdBXLtgQYvuGu1plSZT/5VAA4RnhYpJ
|
||||
7O+tnvFt00k/iCi/bWmCXY4kCvrEVNeLtALoa9znOVMhiBtGGiFxO3iQ+y7jxF6J
|
||||
49O99G8gPGjMm/BdFjnBpUZ+Z5ZGXvrKTZaQRDE5HXEM8dUTBXPL4+dMdfQIiyKZ
|
||||
pNklwkMjS4/LY6xDP16Wj25bSq5W9WSlTja/ZJ2eKqr6c7WxKP6TvjGh9FMkIUps
|
||||
Bl9BNKmgixgiHVq/4WwUSZ1PAEuGQJiptVdeJcgioQKBgQDDdNaRg6Z5yVk+UjXw
|
||||
DHJkUmquowijJUG/2seLYMFm1lkr9xbGvfGfnOSr79jim3haL/qichWh++QjeBsM
|
||||
fwBPMbRY+JNMHpaDpvHAI2YNqXP+rBr4pJnICrHoqIzVqxbDJ04LQZBRD10cTlFz
|
||||
+l+Ok60XTAX/wlKN96BnjuOVXQKBgQDDc2aoU37E4wPYNXcMLvoDv3+Zq3KCEMQD
|
||||
gtNgSbyd37Dw8n35TGWubFLsvYnPLBebB6wAgTPzvTpJmPTr7nKUJsd4rbfvuh+i
|
||||
vVhH/2xq70Pi1XqvQkmo+H1OJX+t2n/Hxr7TQGkqVI9eNfvW8UP+TGPjxGIw8Y0b
|
||||
6t8Ky6USVwKBgQCszV5qVh9Xqtj4zUwch5SW93qUHVWkj2rayP0ET62NUtKRmSmM
|
||||
2h+GAvr0u99fMR6tdZ+8AOr5RC7F4Qjg+mN2oLYWtuXbNWvSx0USnvk5+Oexb82E
|
||||
qFnBTxtNW77vpQxByz0nnHaQA+pI/UDsLZ5P+mXco/zlypKcKyKoi97PjQKBgDQV
|
||||
9+CZx6m+edLPhLc5eaUwDlgsaWqh/yqUXbJGVD6aUzQS22Fpa5uNAJhYdnZAYNYO
|
||||
uFa2F9s3rWXZnkOVmvFCWFwfp2n6Zt3eqb0eI41nz+aOT5CPEMQ33GTL93ekR/M8
|
||||
UrRHcP8347EOn9uLFjyZrPEQ773tUVaERAZDeO0nAoGAZXMhlmKmqTrM2jSb64ja
|
||||
pEddcEW2LuTvwQueOKUuSSwmCydKXkcgrYZ4EHyOgvVN9JZ5ZfW6ZathFipVEKdy
|
||||
diQ860kC4h++erAa8dvB1DUG5oldYYPiEKOyyyn+tNU298QcEkLrG1JcLuUXpfTg
|
||||
8dPIr+VpGomsvpwGTfJFjlE=
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGd8N4RsRov6Kd81z
|
||||
iclbCpD5e7nT1cTN2u8XQZRU/1ChRANCAATHOCZrM/6Ry1iMHtpL3OM+nm2NZJwb
|
||||
T91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZRg0F
|
||||
-----END PRIVATE KEY-----";
|
||||
private static $ssl_certificate_sni_crt = "-----BEGIN CERTIFICATE-----
|
||||
MIIGMTCCBRmgAwIBAgIRANRDAE1KIec3seJ9ed+Qy4UwDQYJKoZIhvcNAQELBQAw
|
||||
gY8xCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
|
||||
BgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE3MDUGA1UE
|
||||
AxMuU2VjdGlnbyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBD
|
||||
QTAeFw0yMjA3MTIwMDAwMDBaFw0yMzA4MTIyMzU5NTlaMBgxFjAUBgNVBAMMDSou
|
||||
bWl2aXRhLmNhcmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVOhtO
|
||||
TJBn5V9SmHmo/EawNiO0VwHOVnnrfnaPD2A1DeKqHmAfMTaybHaCfi+mufV8veem
|
||||
fY1j6rXq7RFU46SMBbFlfZqKS/3zb2d3yRT7OBU83PV5P8JXHrqEArlmKiOZcPoj
|
||||
86TTAbq5wwxjFXkePzJSdOdUN/Z1E1tI8ieUQC40tpMsRvf5XOzQZousXBT1P6F9
|
||||
Q2FbUKEfiEBJ0wjnz74a73U7DebuYGEFPSjVjrkVB11+55y1MBkwg/6JIro+BlXo
|
||||
rW6Xaifb1PKFbTFQnlC4BAKyPHxNKWZCSHgw/C3A7fBQKHM1wVhZo2BZrumdE+X1
|
||||
FOScWlN+M/+TyUybAgMBAAGjggL8MIIC+DAfBgNVHSMEGDAWgBSNjF7EVK2K4Xfp
|
||||
m/mbBeG4AY1h4TAdBgNVHQ4EFgQUCS0Y1v7p19isO7cTuP3YrKVr2OcwDgYDVR0P
|
||||
AQH/BAQDAgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
|
||||
AQUFBwMCMEkGA1UdIARCMEAwNAYLKwYBBAGyMQECAgcwJTAjBggrBgEFBQcCARYX
|
||||
aHR0cHM6Ly9zZWN0aWdvLmNvbS9DUFMwCAYGZ4EMAQIBMIGEBggrBgEFBQcBAQR4
|
||||
MHYwTwYIKwYBBQUHMAKGQ2h0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2VjdGlnb1JT
|
||||
QURvbWFpblZhbGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcnQwIwYIKwYBBQUHMAGG
|
||||
F2h0dHA6Ly9vY3NwLnNlY3RpZ28uY29tMCUGA1UdEQQeMByCDSoubWl2aXRhLmNh
|
||||
cmWCC21pdml0YS5jYXJlMIIBfgYKKwYBBAHWeQIEAgSCAW4EggFqAWgAdQCt9776
|
||||
fP8QyIudPZwePhhqtGcpXc+xDCTKhYY069yCigAAAYHxRovYAAAEAwBGMEQCIA3z
|
||||
UR5BFV7bwBcdRhS8mru20uq36DNz3ILivZh9yl4CAiAUjDxqZBW0Po/0Rm0gumI1
|
||||
VBZfqMSDiA7Cr1peGN8B8wB3AHoyjFTYty22IOo44FIe6YQWcDIThU070ivBOlej
|
||||
UutSAAABgfFGi6UAAAQDAEgwRgIhAN9s3/v2ygh1tfPQ8iX2dLZdOVxyuvC7bf15
|
||||
KP4NQyabAiEAz88hRBxRu3FifpLaYNjwxy1fRUc2luWfDdw+f31TOfoAdgDoPtDa
|
||||
PvUGNTLnVyi8iWvJA9PL0RFr7Otp4Xd9bQa9bgAAAYHxRot7AAAEAwBHMEUCIQCQ
|
||||
RYqkeiRlStQacqUjuw5435NqNDqDlydAVYgywX05pwIgdcFtcLMGevO/KRyUeuWw
|
||||
8hYY6y1S7VYVdcFIuZVp5mswDQYJKoZIhvcNAQELBQADggEBAA0eEYSKcbgEPczo
|
||||
ABXpVsfbmaZqPhAKqcqKeGUcmFo7JHVPRUyck8RAF+SravyaHhilygU727QG4oUt
|
||||
riCewV39cKD2m7CO24WHe5+Fw8eslsJE+DBq/2WpLRJIGSWLl1r7WUELKQhqEYkr
|
||||
DCpkDXpG+lsDIfc5DC4dPLSWc9ezObsS4KEMCMDw+bj5GMGV6dHQZxAnbyqi71+v
|
||||
4+AOHpcYfe6v63w82M0YN5oTnaOukLVDgMXJ7WZP2op7atojB7DeM7k3+fj79kVJ
|
||||
jUGlvHLdN9jsczEZGGxL3w5oIjC4HMK1U5kyzEFWpc8ZLg+YPvF8w15lbhIXG94l
|
||||
JscmCFU=
|
||||
MIIEpzCCBEygAwIBAgIRAOdJ/xXHharlPCF26cIYht0wCgYIKoZIzj0EAwIwgY8x
|
||||
CzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNV
|
||||
BAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE3MDUGA1UEAxMu
|
||||
U2VjdGlnbyBFQ0MgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTAe
|
||||
Fw0yMzA3MzEwMDAwMDBaFw0yNDA4MzAyMzU5NTlaMBgxFjAUBgNVBAMMDSoubWl2
|
||||
aXRhLmNhcmUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATHOCZrM/6Ry1iMHtpL
|
||||
3OM+nm2NZJwbT91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZ
|
||||
Rg0Fo4IC/TCCAvkwHwYDVR0jBBgwFoAU9oUKOxGG4QR9DqoLLNLuzGR7e64wHQYD
|
||||
VR0OBBYEFJco1/8VAvZA85Ct2Z/7XSA+DKNUMA4GA1UdDwEB/wQEAwIHgDAMBgNV
|
||||
HRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBJBgNVHSAE
|
||||
QjBAMDQGCysGAQQBsjEBAgIHMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGln
|
||||
by5jb20vQ1BTMAgGBmeBDAECATCBhAYIKwYBBQUHAQEEeDB2ME8GCCsGAQUFBzAC
|
||||
hkNodHRwOi8vY3J0LnNlY3RpZ28uY29tL1NlY3RpZ29FQ0NEb21haW5WYWxpZGF0
|
||||
aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5z
|
||||
ZWN0aWdvLmNvbTAlBgNVHREEHjAcgg0qLm1pdml0YS5jYXJlggttaXZpdGEuY2Fy
|
||||
ZTCCAX8GCisGAQQB1nkCBAIEggFvBIIBawFpAHcAdv+IPwq2+5VRwmHM9Ye6NLSk
|
||||
zbsp3GhCCp/mZ0xaOnQAAAGJquwmHwAABAMASDBGAiEA7/7/S0CxtvREygwS3qR5
|
||||
THaAwfObqF09zN4AE+rjGSQCIQDNat5O0VSbx+cwaNrrVWz86C0PnUufqWNkBVEa
|
||||
5XM0bQB2ANq2v2s/tbYin5vCu1xr6HCRcWy7UYSFNL2kPTBI1/urAAABiarsJnYA
|
||||
AAQDAEcwRQIhAMkJ4iRoexvBzGa7zuHLn0/R4iDvUstKVb7ZK1XqjuVQAiACwcKG
|
||||
5WNIIeTjJ+CNDeME8mqHpgbFNWIAiiz0u+ANZwB2AO7N0GTV2xrOxVy3nbTNE6Iy
|
||||
h0Z8vOzew1FIWUZxH7WbAAABiarsJmEAAAQDAEcwRQIgVVxidEYEx6g2xLxAcI57
|
||||
eKJ4NDol/bnhmb0iERQmXOoCIQDf6Hviv4+SO+K3OoxxLI9qzFHNP6sb6aDaXfTW
|
||||
ucyTtTAKBggqhkjOPQQDAgNJADBGAiEA4hOvVoXr58YPVGi5/UEEnyDXlUfX4ZKq
|
||||
9PmblI2ZQVkCIQDRllVwklX+DUBcvzG6hapvn5Wv2171yIeoJo+vm7UO5g==
|
||||
-----END CERTIFICATE-----";
|
||||
private static $ssl_certificate_sni_bundle = "-----BEGIN CERTIFICATE-----
|
||||
MIIGEzCCA/ugAwIBAgIQfVtRJrR2uhHbdBYLvFMNpzANBgkqhkiG9w0BAQwFADCB
|
||||
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
|
||||
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
|
||||
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTgx
|
||||
MTAyMDAwMDAwWhcNMzAxMjMxMjM1OTU5WjCBjzELMAkGA1UEBhMCR0IxGzAZBgNV
|
||||
BAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEYMBYGA1UE
|
||||
ChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQDEy5TZWN0aWdvIFJTQSBEb21haW4g
|
||||
VmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
|
||||
AQ8AMIIBCgKCAQEA1nMz1tc8INAA0hdFuNY+B6I/x0HuMjDJsGz99J/LEpgPLT+N
|
||||
TQEMgg8Xf2Iu6bhIefsWg06t1zIlk7cHv7lQP6lMw0Aq6Tn/2YHKHxYyQdqAJrkj
|
||||
eocgHuP/IJo8lURvh3UGkEC0MpMWCRAIIz7S3YcPb11RFGoKacVPAXJpz9OTTG0E
|
||||
oKMbgn6xmrntxZ7FN3ifmgg0+1YuWMQJDgZkW7w33PGfKGioVrCSo1yfu4iYCBsk
|
||||
Haswha6vsC6eep3BwEIc4gLw6uBK0u+QDrTBQBbwb4VCSmT3pDCg/r8uoydajotY
|
||||
uK3DGReEY+1vVv2Dy2A0xHS+5p3b4eTlygxfFQIDAQABo4IBbjCCAWowHwYDVR0j
|
||||
BBgwFoAUU3m/WqorSs9UgOHYm8Cd8rIDZsswHQYDVR0OBBYEFI2MXsRUrYrhd+mb
|
||||
+ZsF4bgBjWHhMA4GA1UdDwEB/wQEAwIBhjASBgNVHRMBAf8ECDAGAQH/AgEAMB0G
|
||||
A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAbBgNVHSAEFDASMAYGBFUdIAAw
|
||||
CAYGZ4EMAQIBMFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9jcmwudXNlcnRydXN0
|
||||
LmNvbS9VU0VSVHJ1c3RSU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDB2Bggr
|
||||
BgEFBQcBAQRqMGgwPwYIKwYBBQUHMAKGM2h0dHA6Ly9jcnQudXNlcnRydXN0LmNv
|
||||
bS9VU0VSVHJ1c3RSU0FBZGRUcnVzdENBLmNydDAlBggrBgEFBQcwAYYZaHR0cDov
|
||||
L29jc3AudXNlcnRydXN0LmNvbTANBgkqhkiG9w0BAQwFAAOCAgEAMr9hvQ5Iw0/H
|
||||
ukdN+Jx4GQHcEx2Ab/zDcLRSmjEzmldS+zGea6TvVKqJjUAXaPgREHzSyrHxVYbH
|
||||
7rM2kYb2OVG/Rr8PoLq0935JxCo2F57kaDl6r5ROVm+yezu/Coa9zcV3HAO4OLGi
|
||||
H19+24rcRki2aArPsrW04jTkZ6k4Zgle0rj8nSg6F0AnwnJOKf0hPHzPE/uWLMUx
|
||||
RP0T7dWbqWlod3zu4f+k+TY4CFM5ooQ0nBnzvg6s1SQ36yOoeNDT5++SR2RiOSLv
|
||||
xvcRviKFxmZEJCaOEDKNyJOuB56DPi/Z+fVGjmO+wea03KbNIaiGCpXZLoUmGv38
|
||||
sbZXQm2V0TP2ORQGgkE49Y9Y3IBbpNV9lXj9p5v//cWoaasm56ekBYdbqbe4oyAL
|
||||
l6lFhd2zi+WJN44pDfwGF/Y4QA5C5BIG+3vzxhFoYt/jmPQT2BVPi7Fp2RBgvGQq
|
||||
6jG35LWjOhSbJuMLe/0CjraZwTiXWTb2qHSihrZe68Zk6s+go/lunrotEbaGmAhY
|
||||
LcmsJWTyXnW0OMGuf1pGg+pRyrbxmRE1a6Vqe8YAsOf4vmSyrcjC8azjUeqkk+B5
|
||||
yOGBQMkKW+ESPMFgKuOXwIlCypTPRpgSabuY0MLTDXJLR27lk8QyKGOHQ+SwMj4K
|
||||
00u/I5sUKUErmgQfky3xxzlIPK1aEn8=
|
||||
MIIDqDCCAy6gAwIBAgIRAPNkTmtuAFAjfglGvXvh9R0wCgYIKoZIzj0EAwMwgYgx
|
||||
CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRQwEgYDVQQHEwtKZXJz
|
||||
ZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMS4wLAYDVQQD
|
||||
EyVVU0VSVHJ1c3QgRUNDIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTE4MTEw
|
||||
MjAwMDAwMFoXDTMwMTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAkdCMRswGQYDVQQI
|
||||
ExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoT
|
||||
D1NlY3RpZ28gTGltaXRlZDE3MDUGA1UEAxMuU2VjdGlnbyBFQ0MgRG9tYWluIFZh
|
||||
bGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTBZMBMGByqGSM49AgEGCCqGSM49AwEH
|
||||
A0IABHkYk8qfbZ5sVwAjBTcLXw9YWsTef1Wj6R7W2SUKiKAgSh16TwUwimNJE4xk
|
||||
IQeV/To14UrOkPAY9z2vaKb71EijggFuMIIBajAfBgNVHSMEGDAWgBQ64QmG1M8Z
|
||||
wpZ2dEl23OA1xmNjmjAdBgNVHQ4EFgQU9oUKOxGG4QR9DqoLLNLuzGR7e64wDgYD
|
||||
VR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0lBBYwFAYIKwYB
|
||||
BQUHAwEGCCsGAQUFBwMCMBsGA1UdIAQUMBIwBgYEVR0gADAIBgZngQwBAgEwUAYD
|
||||
VR0fBEkwRzBFoEOgQYY/aHR0cDovL2NybC51c2VydHJ1c3QuY29tL1VTRVJUcnVz
|
||||
dEVDQ0NlcnRpZmljYXRpb25BdXRob3JpdHkuY3JsMHYGCCsGAQUFBwEBBGowaDA/
|
||||
BggrBgEFBQcwAoYzaHR0cDovL2NydC51c2VydHJ1c3QuY29tL1VTRVJUcnVzdEVD
|
||||
Q0FkZFRydXN0Q0EuY3J0MCUGCCsGAQUFBzABhhlodHRwOi8vb2NzcC51c2VydHJ1
|
||||
c3QuY29tMAoGCCqGSM49BAMDA2gAMGUCMEvnx3FcsVwJbZpCYF9z6fDWJtS1UVRs
|
||||
cS0chWBNKPFNpvDKdrdKRe+oAkr2jU+ubgIxAODheSr2XhcA7oz9HmedGdMhlrd9
|
||||
4ToKFbZl+/OnFFzqnvOhcjHvClECEQcKmc8fmA==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFgTCCBGmgAwIBAgIQOXJEOvkit1HX02wQ3TE1lTANBgkqhkiG9w0BAQwFADB7
|
||||
MIID0zCCArugAwIBAgIQVmcdBOpPmUxvEIFHWdJ1lDANBgkqhkiG9w0BAQwFADB7
|
||||
MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD
|
||||
VQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UE
|
||||
AwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTE5MDMxMjAwMDAwMFoXDTI4
|
||||
MTIzMTIzNTk1OVowgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5
|
||||
MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBO
|
||||
ZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAgBJlFzYOw9sI
|
||||
s9CsVw127c0n00ytUINh4qogTQktZAnczomfzD2p7PbPwdzx07HWezcoEStH2jnG
|
||||
vDoZtF+mvX2do2NCtnbyqTsrkfjib9DsFiCQCT7i6HTJGLSR1GJk23+jBvGIGGqQ
|
||||
Ijy8/hPwhxR79uQfjtTkUcYRZ0YIUcuGFFQ/vDP+fmyc/xadGL1RjjWmp2bIcmfb
|
||||
IWax1Jt4A8BQOujM8Ny8nkz+rwWWNR9XWrf/zvk9tyy29lTdyOcSOk2uTIq3XJq0
|
||||
tyA9yn8iNK5+O2hmAUTnAU5GU5szYPeUvlM3kHND8zLDU+/bqv50TmnHa4xgk97E
|
||||
xwzf4TKuzJM7UXiVZ4vuPVb+DNBpDxsP8yUmazNt925H+nND5X4OpWaxKXwyhGNV
|
||||
icQNwZNUMBkTrNN9N6frXTpsNVzbQdcS2qlJC9/YgIoJk2KOtWbPJYjNhLixP6Q5
|
||||
D9kCnusSTJV882sFqV4Wg8y4Z+LoE53MW4LTTLPtW//e5XOsIzstAL81VXQJSdhJ
|
||||
WBp/kjbmUZIO8yZ9HE0XvMnsQybQv0FfQKlERPSZ51eHnlAfV1SoPv10Yy+xUGUJ
|
||||
5lhCLkMaTLTwJUdZ+gQek9QmRkpQgbLevni3/GcV4clXhB4PY9bpYrrWX1Uu6lzG
|
||||
KAgEJTm4Diup8kyXHAc/DVL17e8vgg8CAwEAAaOB8jCB7zAfBgNVHSMEGDAWgBSg
|
||||
EQojPpbxB+zirynvgqV/0DCktDAdBgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rID
|
||||
ZsswDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAG
|
||||
BgRVHSAAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29t
|
||||
L0FBQUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDQGCCsGAQUFBwEBBCgwJjAkBggr
|
||||
BgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2EuY29tMA0GCSqGSIb3DQEBDAUA
|
||||
A4IBAQAYh1HcdCE9nIrgJ7cz0C7M7PDmy14R3iJvm3WOnnL+5Nb+qh+cli3vA0p+
|
||||
rvSNb3I8QzvAP+u431yqqcau8vzY7qN7Q/aGNnwU4M309z/+3ri0ivCRlv79Q2R+
|
||||
/czSAaF9ffgZGclCKxO/WIu6pKJmBHaIkU4MiRTOok3JMrO66BQavHHxW/BBC5gA
|
||||
CiIDEOUMsfnNkjcZ7Tvx5Dq2+UUTJnWvu6rvP3t3O9LEApE9GQDTF1w52z97GA1F
|
||||
zZOFli9d31kWTz9RvdVFGD/tSo7oBmF0Ixa1DVBzJ0RHfxBdiSprhTEUxOipakyA
|
||||
vGp4z7h/jnZymQyd/teRCBaho1+V
|
||||
ZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgRUNDIENlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEGqxUWqn5aCPnetUkb1PGWthL
|
||||
q8bVttHmc3Gu3ZzWDGH926CJA7gFFOxXzu5dP+Ihs8731Ip54KODfi2X0GHE8Znc
|
||||
JZFjq38wo7Rw4sehM5zzvy5cU7Ffs30yf4o043l5o4HyMIHvMB8GA1UdIwQYMBaA
|
||||
FKARCiM+lvEH7OKvKe+CpX/QMKS0MB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1
|
||||
xmNjmjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zARBgNVHSAECjAI
|
||||
MAYGBFUdIAAwQwYDVR0fBDwwOjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5j
|
||||
b20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNAYIKwYBBQUHAQEEKDAmMCQG
|
||||
CCsGAQUFBzABhhhodHRwOi8vb2NzcC5jb21vZG9jYS5jb20wDQYJKoZIhvcNAQEM
|
||||
BQADggEBABns652JLCALBIAdGN5CmXKZFjK9Dpx1WywV4ilAbe7/ctvbq5AfjJXy
|
||||
ij0IckKJUAfiORVsAYfZFhr1wHUrxeZWEQff2Ji8fJ8ZOd+LygBkc7xGEJuTI42+
|
||||
FsMuCIKchjN0djsoTI0DQoWz4rIjQtUfenVqGtF8qmchxDM6OW1TyaLtYiKou+JV
|
||||
bJlsQ2uRl9EMC5MCHdK8aXdJ5htN978UeAOwproLtOGFfy/cQjutdAFI3tZs4RmY
|
||||
CV4Ks2dH/hzg1cEo70qLRDEmBDeNiXQ2Lu+lIg+DdEmSx/cQwgwp+7e9un/jX9Wf
|
||||
8qn0dNW44bOwgeThpWOjzOoEeJBuv/c=
|
||||
-----END CERTIFICATE-----";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class PayoneController extends Controller
|
|||
$shopping_payment->save();
|
||||
|
||||
$send_link = false;
|
||||
|
||||
$send_mail = true;
|
||||
|
||||
if($data['txaction'] === 'failed'){
|
||||
$shopping_order->setUserHistoryValue(['status' => 6]);
|
||||
|
|
@ -135,10 +135,16 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
if($data['txaction'] === 'paid'){
|
||||
if(!$shopping_order->paid){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
}else{
|
||||
$send_mail = false;
|
||||
}
|
||||
}
|
||||
$data['send_link'] = $send_link;
|
||||
if($send_mail){
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
}
|
||||
print("TSOK");
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class ShoppingUserController extends Controller
|
|||
$data['number'] = ShoppingUser::max('number') + 1;
|
||||
$data['mode'] = $request->mode ? $request->mode : 'live';
|
||||
$data['is_from'] = 'extern';
|
||||
$data['is_for'] = 'ot';
|
||||
$data['is_for'] = 'ot-member';
|
||||
|
||||
$shopping_user = ShoppingUser::create($data);
|
||||
|
||||
|
|
@ -484,7 +484,7 @@ class ShoppingUserController extends Controller
|
|||
foreach ($shopping_order->shopping_order_items as $item){
|
||||
$ret['items'][] = [
|
||||
'article' => $item->product->wp_number,
|
||||
'name' => $item->product->name,
|
||||
'name' => $item->product->getLang('name'),
|
||||
'qty' => $item->qty,
|
||||
'price' => ($item->price * 100),
|
||||
];
|
||||
|
|
@ -593,7 +593,7 @@ class ShoppingUserController extends Controller
|
|||
if ($order->price != ($product->price * 100)) {
|
||||
$error[] = "different price: " . ($product->price * 100);
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith());
|
||||
}
|
||||
}
|
||||
|
|
@ -620,6 +620,7 @@ class ShoppingUserController extends Controller
|
|||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'user_shop_id' => auth()->user()->user_sponsor->shop->id,
|
||||
'payment_for' => 7,
|
||||
'member_id' => $shopping_user->member_id,
|
||||
|
|
@ -711,7 +712,7 @@ class ShoppingUserController extends Controller
|
|||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
|
||||
Mail::to($user_mail)->bcc($bcc)->send(new MailCheckout($shopping_order->txaction, $shopping_order, null, false, $shopping_order->mode));
|
||||
Mail::to($user_mail)->bcc($bcc)->locale($shopping_order->getLocale())->send(new MailCheckout($shopping_order->txaction, $shopping_order, null, false, $shopping_order->mode));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ class BusinessCommissionController extends Controller
|
|||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'filter_members' => $filter_members,
|
||||
'filter_show' => $this->filter_show,
|
||||
|
|
@ -108,7 +108,7 @@ class BusinessCommissionController extends Controller
|
|||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
|
||||
})*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,9 @@ class BusinessController extends Controller
|
|||
{
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'filter_active' => $this->filter_active,
|
||||
|
||||
];
|
||||
return view('admin.business.show', $data);
|
||||
}
|
||||
|
|
@ -45,7 +44,7 @@ class BusinessController extends Controller
|
|||
$TreeCalcBot->initStructureAdmin();
|
||||
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'TreeCalcBot' => $TreeCalcBot,
|
||||
];
|
||||
|
|
@ -94,7 +93,13 @@ class BusinessController extends Controller
|
|||
if(!session('business_user_filter_active')){
|
||||
session(['business_user_filter_active' => 1]);
|
||||
}
|
||||
if(!session('business_user_filter_depiction')){
|
||||
session(['business_user_filter_depiction' => 'active']);
|
||||
}
|
||||
|
||||
if(Request::get('business_user_filter_depiction')){
|
||||
session(['business_user_filter_depiction' => Request::get('business_user_filter_depiction')]);
|
||||
}
|
||||
if(Request::get('business_user_filter_name')){
|
||||
session(['business_user_filter_name' => Request::get('business_user_filter_name')]);
|
||||
}
|
||||
|
|
@ -166,7 +171,7 @@ class BusinessController extends Controller
|
|||
->addColumn('is_qual_kp', function (UserBusiness $userBusiness) {
|
||||
if($userBusiness->m_level_id){
|
||||
$isQualKP = ($userBusiness->sales_volume_points_sum >= $userBusiness->qual_kp) ? true : false;
|
||||
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KP '.$userBusiness->qual_kp.'</span>';
|
||||
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KU '.$userBusiness->qual_kp.'</span>';
|
||||
}
|
||||
return '-';
|
||||
})
|
||||
|
|
@ -295,14 +300,14 @@ class BusinessController extends Controller
|
|||
return $user->account ? $user->account->m_account : '';
|
||||
})
|
||||
->addColumn('user_level', function (User $user) {
|
||||
return $user->user_level ? $user->user_level->name : '';
|
||||
return $user->user_level ? $user->user_level->getLang('name') : '';
|
||||
})
|
||||
->addColumn('is_qual_kp', function (User $user) {
|
||||
if($user->user_level){
|
||||
$qual_kp = $user->user_level->qual_kp;
|
||||
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_sum');
|
||||
$isQualKP = ($sales_volume_points_sum >= $qual_kp) ? true : false;
|
||||
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-warning-dark').'"> KP '.$qual_kp.'</span>';
|
||||
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-warning-dark').'"> KU '.$qual_kp.'</span>';
|
||||
}
|
||||
return '-';
|
||||
})
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ class BusinessPointsController extends Controller
|
|||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'filter_members' => $filter_members,
|
||||
'filter_status_types' => UserSalesVolume::getTransStatusType(),
|
||||
|
||||
|
||||
];
|
||||
return view('admin.business.points', $data);
|
||||
|
|
@ -76,6 +78,7 @@ class BusinessPointsController extends Controller
|
|||
}
|
||||
|
||||
session(['points_filter_member_id' => Request::get('points_filter_member_id')]);
|
||||
session(['points_filter_status_type_id' => Request::get('points_filter_status_type_id')]);
|
||||
|
||||
if(Request::get('points_filter_month')){
|
||||
session(['points_filter_month' => Request::get('points_filter_month')]);
|
||||
|
|
@ -98,6 +101,9 @@ class BusinessPointsController extends Controller
|
|||
if(Request::get('points_filter_member_id')){
|
||||
$query->where('user_sales_volumes.user_id', '=', Request::get('points_filter_member_id'));
|
||||
}
|
||||
if(Request::get('points_filter_status_type_id')){
|
||||
$query->where('user_sales_volumes.status', '=', Request::get('points_filter_status_type_id'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +118,7 @@ class BusinessPointsController extends Controller
|
|||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
|
||||
})
|
||||
->addColumn('order', function (UserSalesVolume $UserSalesVolume) {
|
||||
if($UserSalesVolume->shopping_order){
|
||||
|
|
@ -128,6 +134,9 @@ class BusinessPointsController extends Controller
|
|||
->addColumn('total_net', function (UserSalesVolume $UserSalesVolume) {
|
||||
return formatNumber($UserSalesVolume->total_net).' €';
|
||||
})
|
||||
->addColumn('status_turnover', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusTurnoverColor().'">'.$UserSalesVolume->getStatusTurnoverType().'</span>';
|
||||
})
|
||||
->addColumn('status', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusColor().'">'.$UserSalesVolume->getStatusType().'</span>';
|
||||
})
|
||||
|
|
@ -172,7 +181,7 @@ class BusinessPointsController extends Controller
|
|||
->orderColumn('m_account', 'm_account $1')
|
||||
->orderColumn('first_name', 'first_name $1')
|
||||
->orderColumn('last_name', 'last_name $1')
|
||||
->rawColumns(['id', 'order', 'status', 'status_points', 'message', 'info', 'total_net'])
|
||||
->rawColumns(['id', 'order', 'status_turnover', 'status', 'status_points', 'message', 'info', 'total_net'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ class CategoryController extends Controller
|
|||
return redirect(route('admin_product_categories'));
|
||||
}
|
||||
if(Category::where('parent_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird als Haup-Kategorie verwendet');
|
||||
\Session()->flash('alert-error', 'Eintrag wird als Haupt-Kategorie verwendet');
|
||||
return redirect(route('admin_product_categories'));
|
||||
}
|
||||
$model = Category::findOrFail($id);
|
||||
|
|
@ -184,15 +184,15 @@ class CategoryController extends Controller
|
|||
$category->headline_image_id = $iq_image->id;
|
||||
$category->save();
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
\Session()->flash('alert-success', __('msg.file_uploaded'));
|
||||
return redirect(route('admin_product_category_edit', [$category->id]));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
\Session()->flash('alert-danger', __('msg.file_empty'));
|
||||
return redirect(route('admin_product_category_edit', [$category->id]));
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
\Session()->flash('alert-danger', "Error: ".$e);
|
||||
return redirect(route('admin_product_category_edit', [$category->id]));
|
||||
}
|
||||
}
|
||||
|
|
@ -210,11 +210,11 @@ class CategoryController extends Controller
|
|||
$iq_image->delete();
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
return redirect(route('admin_product_category_edit', [$category->id]));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
\Session()->flash('alert-danger', __('msg.file_not_found'));
|
||||
return redirect(route('admin_product_category_edit', [$category->id]));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class CountryController extends Controller
|
|||
}
|
||||
$data = [
|
||||
'country' => $model,
|
||||
'trans' => array_keys(config('localization.supportedLocales')),
|
||||
|
||||
];
|
||||
return view('admin.country.edit', $data);
|
||||
|
|
@ -52,6 +51,7 @@ class CountryController extends Controller
|
|||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['switch'] = isset($data['switch']) ? true : false;
|
||||
$data['translate'] = isset($data['translate']) ? true : false;
|
||||
$data['eu_country'] = isset($data['eu_country']) ? true : false;
|
||||
$data['own_eur'] = isset($data['own_eur']) ? true : false;
|
||||
$data['currency'] = isset($data['currency']) ? true : false;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\MailCustomMessage;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use Carbon;
|
||||
use App\User;
|
||||
use App\Services\Util;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserMessage;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Mail\MailCustomMessage;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Services\PaymentHelper;
|
||||
use App\User;
|
||||
use Carbon;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ class CronController extends Controller
|
|||
}
|
||||
//send new remider
|
||||
if ($user->confirmation_code_remider == 0) {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($user->confirmation_code, $user));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyAccount($user->confirmation_code, $user));
|
||||
$user->confirmation_code_to = $next;
|
||||
$user->confirmation_code_remider = 1;
|
||||
$user->save();
|
||||
|
|
@ -106,7 +107,9 @@ class CronController extends Controller
|
|||
die();*/
|
||||
foreach ($users as $user){
|
||||
$this->checkReminderPayments($user);
|
||||
/* Abo Option deaktiviert
|
||||
$this->userInitAboPayment($user);
|
||||
*/
|
||||
}
|
||||
return "TOSK";
|
||||
}
|
||||
|
|
@ -151,11 +154,13 @@ class CronController extends Controller
|
|||
|
||||
//35 reminder_deaktiv, 36 reminder_deaktiv_sepa
|
||||
if(!$user->isActiveAccount()){
|
||||
/* Abo Option deaktiviert
|
||||
if($user->isAboOption()){
|
||||
$isSend = $this->checkIsReminderSend($user, 35);
|
||||
$isSend = $this->checkIsReminderSend($user, 36);
|
||||
return $isSend;
|
||||
}
|
||||
$isSend = $this->checkIsReminderSend($user, 36);
|
||||
*/
|
||||
$isSend = $this->checkIsReminderSend($user, 35);
|
||||
return $isSend;
|
||||
}
|
||||
|
||||
|
|
@ -167,18 +172,24 @@ class CronController extends Controller
|
|||
|
||||
//33 reminder_sec
|
||||
if($user->daysActiveAccount() <= config('mivita.remind_sec_days')){
|
||||
/* Abo Option deaktiviert
|
||||
if(!$user->isAboOption()){
|
||||
$isSend = $this->checkIsReminderSend($user, 33);
|
||||
return $isSend;
|
||||
}
|
||||
*/
|
||||
|
||||
$isSend = $this->checkIsReminderSend($user, 33);
|
||||
return $isSend;
|
||||
}
|
||||
|
||||
//31 reminder_first, 32 reminder_first_sepa
|
||||
if($user->daysActiveAccount() > config('mivita.remind_sec_days')){
|
||||
/* Abo Option deaktiviert
|
||||
if($user->isAboOption()){
|
||||
$isSend = $this->checkIsReminderSend($user, 32);
|
||||
return $isSend;
|
||||
}
|
||||
} */
|
||||
$isSend = $this->checkIsReminderSend($user, 31);
|
||||
return $isSend;
|
||||
}
|
||||
|
|
@ -233,6 +244,7 @@ class CronController extends Controller
|
|||
'button' => $button,
|
||||
];
|
||||
//dump($data);
|
||||
|
||||
$sender = User::find(1);
|
||||
$customer_mail = UserMessage::create([
|
||||
'user_id' => $user->id,
|
||||
|
|
@ -243,9 +255,9 @@ class CronController extends Controller
|
|||
]);
|
||||
try{
|
||||
if($status >= 34){
|
||||
Mail::to($user->email)->bcc(config('app.default_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
Mail::to($user->email)->locale($user->getLocale())->bcc(config('app.default_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}else{
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}
|
||||
}
|
||||
catch(\Exception $e){
|
||||
|
|
@ -274,7 +286,11 @@ class CronController extends Controller
|
|||
if($key !== 'G8ZvEbnP8fEPfnWX4L'){
|
||||
abort(404);
|
||||
}
|
||||
exec("/bin/bash ../cron_script.sh 2>&1", $out, $result);
|
||||
if(Util::isTestSystem()){
|
||||
exec("/bin/bash ../cron_script_local.sh 2>&1", $out, $result);
|
||||
}else{
|
||||
exec("/bin/bash ../cron_script_server.sh 2>&1", $out, $result);
|
||||
}
|
||||
echo "Returncode: " .$result ."<br>";
|
||||
echo "Ausgabe des Scripts: " ."<br>";
|
||||
echo "<pre>"; print_r($out);
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
|
||||
$data['language'] = isset($data['language']) ? $data['language'] : \App::getLocale();
|
||||
$data['has_buyed'] = isset($data['has_buyed']) ? true : false;
|
||||
$data['subscribed'] = isset($data['subscribed']) ? true : false;
|
||||
//subscribed can only true when has_buyed ist active
|
||||
|
|
@ -154,7 +156,7 @@ class CustomerController extends Controller
|
|||
}*/
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingUser $ShoppingUser) {
|
||||
return '<a href="' . route('admin_customer_detail', [$ShoppingUser->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_customer_detail', [$ShoppingUser->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('billing_email', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->faker_mail ? "-" : $ShoppingUser->billing_email;
|
||||
|
|
|
|||
|
|
@ -13,90 +13,4 @@ class DataTableController extends Controller
|
|||
return view('datatable');
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-admin" data-id="'.$user->id.'" data-email="'.$user->email.'" data-admin="'.$user->admin.'">'.HTMLHelper::getRoleLabel($user->admin).'</a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
$date = $user->getConfirmationDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-confirmed" data-id="'.$user->id.'" data-email="'.$user->email.'" data-confirmed="'.$user->confirmed.'" data-confirmation_date="'.$date.'">';
|
||||
return $user->confirmed ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
$date = $user->getActiveDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-active" data-id="'.$user->id.'" data-email="'.$user->email.'" data-active="'.$user->active.'" data-active_date="'.$date.'">';
|
||||
return $user->active ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('account', function (User $user) {
|
||||
$date = $user->getPaymentAccountDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-account" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_account="'.$date.'">';
|
||||
if($user->payment_account){
|
||||
if($user->isActiveAccount()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('shop', function (User $user) {
|
||||
$date = $user->getPaymentShopDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-shop" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_shop="'.$date.'">';
|
||||
if($user->payment_shop){
|
||||
if($user->isActiveShop()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('since', function (User $user) {
|
||||
if($user->shop){
|
||||
if($user->shop->active){
|
||||
return $user->shop->getActiveDateFormatSmall();
|
||||
}
|
||||
return $user->shop->getActiveDateFormatSmall();
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('my_payment_methods', function (User $user) {
|
||||
$payment_methods = json_encode($user->payment_methods);
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-payment_methods" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_methods="'.htmlspecialchars($payment_methods).'">';
|
||||
if(!$user->payment_methods){
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$user->getPaymentMethodsShort().'</span></a>';
|
||||
|
||||
})
|
||||
->addColumn('action_login', function (User $user) {
|
||||
return '<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a>';
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<a class="btn icon-btn btn-sm btn-danger" href="#" data-toggle="modal" data-target="#modals-user-delete" data-id="'.$user->id.'" data-email="'.$user->email.'"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->addColumn('test_mode', function (User $user) {
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-test_mode" data-id="'.$user->id.'" data-email="'.$user->email.'" data-test_mode="'.$user->test_mode.'">';
|
||||
return $user->test_mode ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('shop', 'shop $1')
|
||||
->orderColumn('admin', 'active $1')
|
||||
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_login', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Storage;
|
||||
use Response;
|
||||
use Auth;
|
||||
use App\Models\UserCredit;
|
||||
use App\Repositories\CreditRepository;
|
||||
|
||||
class FileController extends Controller
|
||||
{
|
||||
|
|
@ -32,10 +34,19 @@ class FileController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
|
||||
public function show($id = null, $disk = null, $do='file')
|
||||
private function isPermissionAuth(){
|
||||
if(Auth::check()){
|
||||
return true;
|
||||
}
|
||||
abort(404);
|
||||
}
|
||||
|
||||
public function show($id = null, $from = null, $do='file')
|
||||
{
|
||||
|
||||
$path = "";
|
||||
$filename = "";
|
||||
$disk = "public";
|
||||
|
||||
/*if($disk === 'user'){
|
||||
$file = \App\Models\File::findOrFail($id);
|
||||
|
|
@ -45,8 +56,7 @@ class FileController extends Controller
|
|||
return Response::file($path);
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($disk === 'invoice'){
|
||||
if ($from === 'invoice'){
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->user_invoice){
|
||||
$this->isPermissionShoppingOrder($shopping_order);
|
||||
|
|
@ -54,16 +64,11 @@ class FileController extends Controller
|
|||
$filename = $user_invoice->filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPath();
|
||||
if (!Storage::disk($disk)->exists($path)) {
|
||||
return Response::make('File no found.', 404);;
|
||||
}
|
||||
$file = Storage::disk($disk)->get($path);
|
||||
$mime = Storage::disk($disk)->mimeType($path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($disk === 'delivery'){
|
||||
if ($from === 'delivery'){
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->user_invoice){
|
||||
$this->isPermissionShoppingOrder($shopping_order);
|
||||
|
|
@ -71,27 +76,62 @@ class FileController extends Controller
|
|||
$filename = $user_invoice->delivery_filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPathDelivery();
|
||||
if (!Storage::disk($disk)->exists($path)) {
|
||||
return Response::make('File no found.', 404);;
|
||||
}
|
||||
$file = Storage::disk($disk)->get($path);
|
||||
$mime = Storage::disk($disk)->mimeType($path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($disk === 'credit'){
|
||||
if ($from === 'credit'){
|
||||
$user_credit = \App\Models\UserCredit::findOrFail($id);
|
||||
$this->isPermissionUserCredit($user_credit);
|
||||
$filename = $user_credit->filename;
|
||||
$disk = $user_credit->disk;
|
||||
$path = $user_credit->getDownloadPath();
|
||||
if (!Storage::disk($disk)->exists($path)) {
|
||||
return Response::make('File no found.', 404);;
|
||||
}
|
||||
|
||||
if ($from === 'credit_detail'){
|
||||
$user_credit = \App\Models\UserCredit::findOrFail($id);
|
||||
$this->isPermissionUserCredit($user_credit);
|
||||
|
||||
return $this->create_credit_detail($user_credit, $do);
|
||||
|
||||
|
||||
/*
|
||||
$filename = $user_credit->filename;
|
||||
$disk = $user_credit->disk;
|
||||
$path = $user_credit->getDownloadPath();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
if ($from === 'dc_file'){
|
||||
$this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
$path = $dc_file->getFile();
|
||||
}
|
||||
if ($from === 'dc_thumb'){
|
||||
$this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
$path = $dc_file->getThumb();
|
||||
}
|
||||
|
||||
if ($from === 'dc_big'){
|
||||
$this->isPermissionAuth();
|
||||
$dc_file = \App\Models\DcFile::findOrFail($id);
|
||||
$filename = $dc_file->filename;
|
||||
$disk = 'public';
|
||||
$path = $dc_file->getBig();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!Storage::disk($disk)->exists($path)){
|
||||
// return Response::make('File no found.', 404);
|
||||
}
|
||||
$file = Storage::disk($disk)->get($path);
|
||||
$mime = Storage::disk($disk)->mimeType($path);
|
||||
}
|
||||
|
||||
if(isset($file)){
|
||||
if($do === 'download'){
|
||||
|
|
@ -104,34 +144,35 @@ class FileController extends Controller
|
|||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition','inline; filename="'.$filename.'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if ($disk === 'credit'){
|
||||
$this->isPermission($UserCredit->auth_user_id);
|
||||
|
||||
$filename = Credit::getFilename($UserCredit);
|
||||
$path = Credit::getDownloadPath($UserCredit);
|
||||
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
return Response::make('File no found.', 404);
|
||||
}
|
||||
$file = Storage::disk('public')->get($path);
|
||||
$mime = Storage::disk('public')->mimeType($path);
|
||||
|
||||
if($do === 'download'){
|
||||
if($do === 'file'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
|
||||
->header('Content-disposition', 'filename="'.$filename.'"');
|
||||
}
|
||||
if($do === 'stream'){
|
||||
if($do === 'image'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition','filename="'.$filename.'"');
|
||||
->header("Content-Type", $mime);
|
||||
}
|
||||
if($do === 'pdf'){
|
||||
$path = storage_path().'/app/public/' . $path;
|
||||
|
||||
$headers = array(
|
||||
'Content-Type:'. $mime,
|
||||
// 'Content-Length: ' . $file->size
|
||||
// 'Content-Disposition: ' . $stream . '; filename=' . $file->original_name
|
||||
);
|
||||
|
||||
return Response::download($path, $filename, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
private function create_credit_detail(UserCredit $user_credit, $do){
|
||||
|
||||
$credit_repo = new CreditRepository($user_credit->user);
|
||||
return $credit_repo->create_report($user_credit, $do);
|
||||
//\Session()->flash('alert-success', "Gutschrift erstellt");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ class HomeController extends Controller
|
|||
}
|
||||
|
||||
}else{
|
||||
\Session()->flash('alert-error', "Es ist ein Fehler bei der Bestellung aufgetreten");
|
||||
\Session()->flash('alert-error', __('msg.error_occurred_with_order'));
|
||||
return redirect(route('/'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Validator;
|
|||
use App\Services\SysLog;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Services\UserService;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Mail\MailCustomMessage;
|
||||
|
|
@ -33,13 +34,42 @@ class LeadController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$filter_sponsor = User::join('user_accounts', 'account_id', '=', 'user_accounts.id')->select('users.id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4)->get();
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'values' => User::where('admin', '=', 0)->where('confirmation_code_remider', '!=', 2)->get(),
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'filter_sponsor' => $filter_sponsor,
|
||||
];
|
||||
|
||||
return view('admin.lead.index', $data);
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
/*if(!session('leads_filter_month')){
|
||||
session(['leads_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('leads_filter_year')){
|
||||
session(['leads_filter_year' => intval(date('Y'))]);
|
||||
}*/
|
||||
|
||||
session(['leads_filter_sponsor_id' => Request::get('leads_filter_sponsor_id')]);
|
||||
|
||||
/* if(Request::get('leads_filter_month')){
|
||||
session(['leads_filter_month' => Request::get('leads_filter_month')]);
|
||||
}
|
||||
if(Request::get('leads_filter_year')){
|
||||
session(['leads_filter_year' => Request::get('leads_filter_year')]);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
|
|
@ -122,6 +152,18 @@ class LeadController extends Controller
|
|||
|
||||
$data = Request::all();
|
||||
$show = Request::get('show');
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate" && isset($data['user_id'])){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
return $this->userRepo->reverse_charge_validate($data, $user, route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete" && isset($data['user_id'])){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
return $this->userRepo->reverse_charge_delete($data, $user, route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(isset($data['reverse_charge_validate']) && isset($data['user_id'])){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
$user->wizard = 1;
|
||||
|
|
@ -136,7 +178,7 @@ class LeadController extends Controller
|
|||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_delete($data, $user);
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
|
|
@ -234,7 +276,7 @@ class LeadController extends Controller
|
|||
//10 == start wizard form create Lead
|
||||
$user->wizard = 10;
|
||||
$user->save();
|
||||
Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyContact($confirmation_code, $user));
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_leads'));
|
||||
|
|
@ -242,10 +284,6 @@ class LeadController extends Controller
|
|||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_lead_edit', [$user->id])."?show=".$show);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//user released when register is complete
|
||||
public function released($action, $id){
|
||||
|
|
@ -260,7 +298,7 @@ class LeadController extends Controller
|
|||
if(!$user->account->m_first_name){
|
||||
$validator->errors()->add('m_first_name', __('Berater hat keinen Vornamen.'));
|
||||
}
|
||||
if(!$user->account->m_first_name){
|
||||
if(!$user->account->m_last_name){
|
||||
$validator->errors()->add('m_last_name', __('Berater hat keinen Nachnamen.'));
|
||||
}
|
||||
if(!$user->account->m_account){
|
||||
|
|
@ -288,7 +326,7 @@ class LeadController extends Controller
|
|||
$user->save();
|
||||
|
||||
//mail with code to user?
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailAccountActive($user));
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
|
||||
\Session()->flash('alert-success', "Berater freigeschaltet!");
|
||||
}
|
||||
|
|
@ -312,7 +350,7 @@ class LeadController extends Controller
|
|||
'confirmation_code' => $confirmation_code,
|
||||
];
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
|
|
@ -338,7 +376,7 @@ class LeadController extends Controller
|
|||
$user->save();
|
||||
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
|
|
@ -357,19 +395,36 @@ class LeadController extends Controller
|
|||
if($relation === 'upload'){
|
||||
$user = User::findOrFail($user_id);
|
||||
$file = $user->files()->findOrFail($file_id);
|
||||
if($file->identifier === 'business_license'){
|
||||
$user->account->setNotice('business_license', '');
|
||||
}
|
||||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
private function initSearch()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
//$query = UserSalesVolume::with('user', 'user.account')->with('shopping_order')->select('user_sales_volumes.*')
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 5);
|
||||
if(Request::get('leads_filter_sponsor_id')){
|
||||
$query->where('users.m_sponsor', '=', Request::get('leads_filter_sponsor_id'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function getLeads()
|
||||
{
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
$query = $this->initSearch();
|
||||
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
|
|
@ -379,10 +434,14 @@ class LeadController extends Controller
|
|||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('user_level', function (User $user) {
|
||||
return $user->user_level ? $user->user_level->name : '';
|
||||
return $user->user_level ? '<span class="badge badge-outline-success">'.$user->user_level->name.'</span>' : '';
|
||||
})
|
||||
->addColumn('user_sponsor', function (User $user) {
|
||||
return $user->user_sponsor ?
|
||||
'<span class="badge badge-outline-warning-dark">'.$user->user_sponsor->account->first_name." ".$user->user_sponsor->account->last_name.'</span>' : "-";
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<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>';
|
||||
|
|
@ -393,6 +452,36 @@ class LeadController extends Controller
|
|||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <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>';
|
||||
})
|
||||
|
||||
->addColumn('useractive', function (User $user) {
|
||||
$date = $user->getActiveDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-active" data-id="'.$user->id.'" data-email="'.$user->email.'" data-active="'.$user->active.'" data-active_date="'.$date.'">';
|
||||
return $user->active ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('payaccount', function (User $user) {
|
||||
$date = $user->getPaymentAccountDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-account" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_account="'.$date.'">';
|
||||
if($user->payment_account){
|
||||
if($user->isActiveAccount()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
->addColumn('payshop', function (User $user) {
|
||||
$date = $user->getPaymentShopDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-shop" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_shop="'.$date.'">';
|
||||
if($user->payment_shop){
|
||||
if($user->isActiveShop()){
|
||||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i> '.$date.'</span></a>';
|
||||
}
|
||||
return $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
})
|
||||
|
||||
|
||||
->addColumn('payment_account', function (User $user) {
|
||||
return $user->payment_account ? ' <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>';
|
||||
})
|
||||
|
|
@ -402,11 +491,12 @@ class LeadController extends Controller
|
|||
->addColumn('payment_shop', function (User $user) {
|
||||
return $user->payment_shop ? ' <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>';
|
||||
})
|
||||
|
||||
->addColumn('payment_shop_date', function (User $user) {
|
||||
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
|
||||
})
|
||||
->addColumn('shop_domain', function (User $user) {
|
||||
return $user->shop ? ' <span class="small">'.$user->shop->getSubdomain(false).'</span>' : '';
|
||||
return $user->shop ? ' <span class="small"><a href="'.$user->shop->getSubdomain(false).'" target="_blank">'.$user->shop->getSubdomain(false).'</a></span>' : '';
|
||||
|
||||
})
|
||||
->addColumn('turnover', function (User $user) {
|
||||
|
|
@ -421,7 +511,7 @@ class LeadController extends Controller
|
|||
->orderColumn('agreement', 'agreement $1')
|
||||
->orderColumn('payment_account', 'payment_account $1')
|
||||
->orderColumn('payment_shop', 'payment_shop $1')
|
||||
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account', 'payment_shop', 'shop_domain'])
|
||||
->rawColumns(['id', 'user_level', 'user_sponsor', 'confirmed', 'useractive', 'payaccount', 'payshop', 'agreement', 'active', 'payment_account', 'payment_shop', 'shop_domain'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,6 @@ class ModalController extends Controller
|
|||
|
||||
if($data['action'] === 'user-order-my-delivery-add'){
|
||||
$user = \Auth::user();
|
||||
|
||||
/* $product = Product::find($data['id']); //current user form order
|
||||
$ret = view("admin.modal.show_product", compact('product', 'data'))->render(); */
|
||||
}
|
||||
|
|
@ -108,6 +107,11 @@ class ModalController extends Controller
|
|||
$route = route('admin_level_store', [$value->id]);
|
||||
$ret = view("admin.modal.user_level_edit", compact('value', 'data', 'route'))->render();
|
||||
}
|
||||
if($data['action'] === 'user-level-add'){
|
||||
$value = new UserLevel();
|
||||
$route = route('admin_level_store', ['new']);
|
||||
$ret = view("admin.modal.user_level_edit", compact('value', 'data', 'route'))->render();
|
||||
}
|
||||
if($data['action'] === 'business-user-detail'){
|
||||
$user = User::findOrFail($data['id']);
|
||||
if($data['init_from'] === 'admin'){
|
||||
|
|
@ -121,6 +125,16 @@ class ModalController extends Controller
|
|||
$route = "";
|
||||
$ret = view("admin.modal.business_user_detail", compact('TreeCalcBot', 'user', 'data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === 'business-user-show'){
|
||||
$user = User::find($data['id']);
|
||||
if($user && $user->account){
|
||||
$route = "";
|
||||
$ret = view("admin.modal.business_user_show", compact('user', 'data'))->render();
|
||||
}
|
||||
$ret = view("admin.modal.business_user_notfound", compact('data'))->render();
|
||||
|
||||
}
|
||||
if($data['action'] === 'edit_user_sales_volume'){
|
||||
$userSalesVolume = UserSalesVolume::findOrFail($data['id']);
|
||||
$route = route('admin_business_points_store', );
|
||||
|
|
|
|||
|
|
@ -27,10 +27,9 @@ namespace App\Http\Controllers\Pay;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Services\MyLog;
|
||||
use App\Services\Payone;
|
||||
use Illuminate\Http\Request;
|
||||
use Util;
|
||||
use Yard;
|
||||
|
||||
|
||||
class PayoneController extends Controller
|
||||
|
|
@ -45,6 +44,7 @@ class PayoneController extends Controller
|
|||
private $default = [];
|
||||
|
||||
private $personalData = [];
|
||||
private $aboInitPayment = [];
|
||||
|
||||
private $method = [];
|
||||
private $prepayment = [];
|
||||
|
|
@ -54,6 +54,8 @@ class PayoneController extends Controller
|
|||
private $deliveryData = [];
|
||||
|
||||
|
||||
|
||||
|
||||
// private $payment_method;
|
||||
private $urls = [];
|
||||
|
||||
|
|
@ -95,8 +97,14 @@ class PayoneController extends Controller
|
|||
"amount" => $amount, // amount in smallest currency unit, i.e. cents
|
||||
"currency" => $currency,
|
||||
"param" => $this->shopping_order->id,
|
||||
|
||||
];
|
||||
//init Abo
|
||||
if($this->shopping_order->is_abo){
|
||||
$this->aboInitPayment = [
|
||||
'recurrence'=>'recurring',
|
||||
'customer_is_present'=>'yes'
|
||||
];
|
||||
}
|
||||
|
||||
$this->shopping_payment = ShoppingPayment::create([
|
||||
'shopping_order_id' => $this->shopping_order->id,
|
||||
|
|
@ -106,6 +114,8 @@ class PayoneController extends Controller
|
|||
'reference' => $this->reference,
|
||||
'amount' => $amount,
|
||||
'currency' => $currency,
|
||||
'is_abo' => $this->shopping_order->is_abo,
|
||||
'abo_interval' => $this->shopping_order->abo_interval,
|
||||
'mode' => $this->shopping_order->mode,
|
||||
]);
|
||||
|
||||
|
|
@ -222,7 +232,7 @@ class PayoneController extends Controller
|
|||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
"pseudocardpan" => $ret['cc']['pseudocardpan']
|
||||
"pseudocardpan" => $ret['cc']['pseudocardpan'],
|
||||
//"xid" => "3-D Secure transaction ID"
|
||||
];
|
||||
}
|
||||
|
|
@ -230,14 +240,14 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
public function onlyPaymentResponse(){
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->aboInitPayment, $this->prepayment, $this->urls);
|
||||
$response = Payone::sendRequest($request);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function ResponseData(){
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->aboInitPayment, $this->prepayment, $this->urls);
|
||||
//RECHNUNG MIV
|
||||
if($this->shopping_payment->clearingtype === 'fnc' && $this->shopping_payment->onlinebanktransfertype === 'MIV'){
|
||||
|
||||
|
|
@ -336,14 +346,25 @@ class PayoneController extends Controller
|
|||
|
||||
|
||||
if($response['status'] === 'PENDING'){
|
||||
var_dump($response);
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1000 Status PENDING App\Http\Controllers\Pay\PayoneController::ResponseData response status PENDING',
|
||||
$response
|
||||
);
|
||||
die();
|
||||
//txid
|
||||
//Payment process ID (PAYONE)
|
||||
//userid
|
||||
//Debtor ID (PAYONE)
|
||||
}
|
||||
die("error");
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1001 Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. App\Http\Controllers\Pay\PayoneController::ResponseData error no response status',
|
||||
$response
|
||||
);
|
||||
abort(403, 'Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. Bitte versuchen Sie es später erneut. Fehlercode: 1001');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -365,7 +386,6 @@ class PayoneController extends Controller
|
|||
return Payone::sendRequest($request);
|
||||
}
|
||||
|
||||
|
||||
public function checkBankAccount($data, $amount, $currency, $shopping_user)
|
||||
{
|
||||
$this->shopping_user = $shopping_user;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use App\Models\ShoppingOrderMargin;
|
|||
|
||||
use App\Repositories\CreditRepository;
|
||||
use App\Models\Models\UserCreditMargin as ModelsUserCreditMargin;
|
||||
use App\Models\UserAccount;
|
||||
use stdClass;
|
||||
|
||||
class PaymentCreditController extends Controller
|
||||
|
|
@ -32,7 +33,7 @@ class PaymentCreditController extends Controller
|
|||
{
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
'user_credit_items' => $this->makeUserCreditItems(),
|
||||
];
|
||||
|
|
@ -113,6 +114,20 @@ class PaymentCreditController extends Controller
|
|||
if(isset($ret[$userCreditItem->user_id])){
|
||||
$ret[$userCreditItem->user_id]['sum'] += $userCreditItem->credit;
|
||||
$ret[$userCreditItem->user_id]['entries'][$userCreditItem->id] = $userCreditItem;
|
||||
}else{
|
||||
if(!isset($userCreditItem->user)){
|
||||
/* gelöschte User nicht anzeigen
|
||||
$user = User::withTrashed()->with(['account' => fn($q) => $q->withTrashed()])->where('id', $userCreditItem->user_id)->first();
|
||||
$ret[$userCreditItem->user_id] = [
|
||||
'user_id' => $userCreditItem->user_id,
|
||||
'm_account' => $user ? $user->account->m_account : "gelöscht",
|
||||
'first_name' => $user ? $user->account->first_name : "gelöscht",
|
||||
'last_name' => $user ? $user->account->last_name : "gelöscht",
|
||||
'email' => $user ? $user->email : "gelöscht",
|
||||
'sum' => $userCreditItem->credit,
|
||||
'entries' => [$userCreditItem->id => $userCreditItem],
|
||||
];
|
||||
*/
|
||||
}else{
|
||||
$ret[$userCreditItem->user_id] = [
|
||||
'user_id' => $userCreditItem->user_id,
|
||||
|
|
@ -125,6 +140,7 @@ class PaymentCreditController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +163,6 @@ class PaymentCreditController extends Controller
|
|||
|
||||
$this->setFilterVars();
|
||||
|
||||
|
||||
$date_start = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->format('Y-m-d');
|
||||
$date_end = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
|
||||
|
|
@ -155,11 +170,9 @@ class PaymentCreditController extends Controller
|
|||
|
||||
if(Request::get('credit_filter_name')){
|
||||
$query->whereHas('user.account', function ($query) {
|
||||
return $query->where('first_name', 'LIKE', '%'.Request::get('credit_filter_name').'%')->orWhere('last_name', 'LIKE', '%'.Request::get('credit_filter_name').'%');
|
||||
})->get();
|
||||
$query->whereHas('user', function ($query) {
|
||||
return $query->where('email', 'LIKE', '%'.Request::get('credit_filter_name').'%');
|
||||
})->get();
|
||||
return $query->where('first_name', 'LIKE', '%'.Request::get('credit_filter_name').'%')
|
||||
->orWhere('last_name', 'LIKE', '%'.Request::get('credit_filter_name').'%');
|
||||
});
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
|
@ -169,11 +182,26 @@ class PaymentCreditController extends Controller
|
|||
$query = $this->initSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('user.account.first_name', function (UserCredit $UserCredit) {
|
||||
return isset($UserCredit->user->account) ? $UserCredit->user->account->first_name : "gelöscht";
|
||||
})
|
||||
->addColumn('user.account.last_name', function (UserCredit $UserCredit) {
|
||||
return isset($UserCredit->user->account) ? $UserCredit->user->account->last_name : "gelöscht";
|
||||
})
|
||||
->addColumn('user.email', function (UserCredit $UserCredit) {
|
||||
return isset($UserCredit->user) ? $UserCredit->user->email : "gelöscht";
|
||||
})
|
||||
->addColumn('view', function (UserCredit $UserCredit) {
|
||||
$ret = "";
|
||||
if($UserCredit->isCredit()){
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a><br>';
|
||||
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'html']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
|
||||
|
||||
|
||||
}else{
|
||||
$ret = "-";
|
||||
}
|
||||
|
|
@ -187,7 +215,7 @@ class PaymentCreditController extends Controller
|
|||
$ret = "";
|
||||
if($UserCredit->user_credit_items){
|
||||
foreach($UserCredit->user_credit_items as $user_credit_item){
|
||||
$ret .= nl2br($user_credit_item->message)." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
|
||||
$ret .= nl2br($user_credit_item->getTransMessage())." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -199,7 +227,27 @@ class PaymentCreditController extends Controller
|
|||
<span class="badge badge-pill badge-'.$UserCredit->getStatusColor().'">'.$UserCredit->getStatusType().' <span class="ion ion-md-cash"></span></span>
|
||||
</a>';
|
||||
})
|
||||
|
||||
->filterColumn('user.account.first_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereHas('user.account', function ($query) use ($keyword) {
|
||||
return $query->where('first_name', 'LIKE', '%'.$keyword.'%');
|
||||
});
|
||||
}
|
||||
})
|
||||
->filterColumn('user.account.last_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereHas('user.account', function ($query) use ($keyword) {
|
||||
return $query->where('last_name', 'LIKE', '%'.$keyword.'%');
|
||||
});
|
||||
}
|
||||
})
|
||||
->filterColumn('user.email', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereHas('user', function ($query) use ($keyword) {
|
||||
return $query->where('email', 'LIKE', '%'.$keyword.'%');
|
||||
});
|
||||
}
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('status', 'status $1')
|
||||
->orderColumn('total', 'total $1')
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class PaymentInvoiceController extends Controller
|
|||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
];
|
||||
return view('admin.payment.invoice', $data);
|
||||
|
|
@ -81,15 +81,6 @@ class PaymentInvoiceController extends Controller
|
|||
->addColumn('created_at', function (UserInvoice $UserInvoice) {
|
||||
return $UserInvoice->created_at->format("d.m.Y");
|
||||
})
|
||||
/*
|
||||
->addColumn('shipping_order', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
foreach($UserInvoice->shopping_order_items as $shopping_order_item){
|
||||
$ret .= $shopping_order_item->product->name."<br>";
|
||||
}
|
||||
return $ret;
|
||||
})
|
||||
*/
|
||||
->addColumn('txaction', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order){
|
||||
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
|
||||
|
|
@ -113,6 +104,9 @@ class PaymentInvoiceController extends Controller
|
|||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->orderColumn('created_at', 'created_at $1')
|
||||
->orderColumn('status', 'status $1')
|
||||
|
||||
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
|
||||
->make(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class PaymentMethodController extends Controller
|
|||
'short' => $data['short'],
|
||||
'pos' => $data['pos'],
|
||||
'show_on' => isset($data['show_on']) ? $data['show_on'] : null,
|
||||
'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : null,
|
||||
'default' => isset($data['default']) ? true : false,
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
|
|
@ -44,6 +45,7 @@ class PaymentMethodController extends Controller
|
|||
$model->name = $data['name'];
|
||||
$model->short = $data['short'];
|
||||
$model->pos = $data['pos'];
|
||||
$model->is_abo = isset($data['is_abo']) ? true : false;
|
||||
$model->show_on = isset($data['show_on']) ? $data['show_on'] : null;
|
||||
$model->default = isset($data['default']) ? true : false;
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class PaymentPointsController extends Controller
|
|||
dd("function?");
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
];
|
||||
return view('admin.payment.invoice', $data);
|
||||
|
|
@ -90,15 +90,6 @@ class PaymentPointsController extends Controller
|
|||
->addColumn('created_at', function (UserInvoice $UserInvoice) {
|
||||
return $UserInvoice->created_at->format("d.m.Y");
|
||||
})
|
||||
/*
|
||||
->addColumn('shipping_order', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
foreach($UserInvoice->shopping_order_items as $shopping_order_item){
|
||||
$ret .= $shopping_order_item->product->name."<br>";
|
||||
}
|
||||
return $ret;
|
||||
})
|
||||
*/
|
||||
->addColumn('txaction', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order){
|
||||
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
|
||||
|
|
|
|||
246
app/Http/Controllers/PaymentTaxAdvisorController.php
Normal file
246
app/Http/Controllers/PaymentTaxAdvisorController.php
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Auth;
|
||||
use Request;
|
||||
use ZipArchive;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Exports\UserTeamExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PaymentTaxAdvisorController extends Controller
|
||||
{
|
||||
|
||||
private $BUKey = [
|
||||
1 => 8120, //für Kunden aus der Schweiz
|
||||
11 => 8125, //Steuerfreie EU-Lieferungen
|
||||
2 => 8300, //Erlöse mit 7 % meistens für Käufe mit Aloe Vera
|
||||
3 => 8400, //Regulär mit 19 %
|
||||
];
|
||||
|
||||
|
||||
private $accountKey = [
|
||||
'A'=>'10000',
|
||||
'B'=>'10100',
|
||||
'C'=>'10200',
|
||||
'D'=>'10300',
|
||||
'E'=>'10400',
|
||||
'F'=>'10500',
|
||||
'G'=>'10600',
|
||||
'H'=>'10700',
|
||||
'I'=>'10800',
|
||||
'J'=>'10900',
|
||||
'K'=>'11000',
|
||||
'L'=>'11100',
|
||||
'M'=>'11200',
|
||||
'N'=>'11300',
|
||||
'O'=>'11400',
|
||||
'P'=>'11500',
|
||||
'Q'=>'11600',
|
||||
'R'=>'11700',
|
||||
'S'=>'11800',
|
||||
'SCH'=>'11900',
|
||||
'T'=>'12000',
|
||||
'U'=>'12100',
|
||||
'V'=>'12200',
|
||||
'W'=>'12300',
|
||||
'X'=>'12400',
|
||||
'Y'=>'12500',
|
||||
'Z'=>'12600'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2023),
|
||||
];
|
||||
return view('admin.payment.taxadvisor', $data);
|
||||
}
|
||||
|
||||
|
||||
public function createZip($filesToZip)
|
||||
{
|
||||
$zip = new ZipArchive;
|
||||
$zipFileName = 'mysample.zip';
|
||||
$path = storage_path().'/app/public/zip/';
|
||||
if ($zip->open($path.$zipFileName, ZipArchive::CREATE) === TRUE) {
|
||||
foreach ($filesToZip as $file) {
|
||||
$zip->addFile($file, basename($file));
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
return response()->download($path.$zipFileName)->deleteFileAfterSend(true);
|
||||
} else {
|
||||
return "Failed to create the zip file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function download(){
|
||||
|
||||
|
||||
$query = $this->initSearch();
|
||||
|
||||
$files = [];
|
||||
|
||||
$user_invoices = $query->get();
|
||||
foreach ($user_invoices as $user_invoice) {
|
||||
$filename = $user_invoice->filename;
|
||||
$disk = $user_invoice->disk;
|
||||
$path = $user_invoice->getDownloadPath();
|
||||
if (Storage::disk($disk)->exists($path)) {
|
||||
$file = Storage::disk($disk)->get($path);
|
||||
$pdf_path = storage_path().'/app/public/'.$path;
|
||||
$files[] = $pdf_path;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->createZip($files);
|
||||
|
||||
dd("asd");
|
||||
|
||||
|
||||
|
||||
if(Request::get('action') === "export"){
|
||||
$objects = $this->initSearch(false);
|
||||
$columns = [];
|
||||
$filename = "mivita-absatzmengen-".session('payment_taxadvisor_filter_month').'_'.session('payment_taxadvisor_filter_year')."-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
'Artikelnummer',
|
||||
'Menge',
|
||||
|
||||
);
|
||||
if($objects){
|
||||
foreach ($objects as $key => $obj){
|
||||
$columns[] = array(
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('payment_taxadvisor_filter_month')){
|
||||
session(['payment_taxadvisor_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('payment_taxadvisor_filter_year')){
|
||||
session(['payment_taxadvisor_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(Request::get('payment_taxadvisor_filter_month')){
|
||||
session(['payment_taxadvisor_filter_month' => Request::get('payment_taxadvisor_filter_month')]);
|
||||
}
|
||||
if(Request::get('payment_taxadvisor_filter_year')){
|
||||
session(['payment_taxadvisor_filter_year' => Request::get('payment_taxadvisor_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function initSearch()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
|
||||
->where('user_invoices.month', '=', Request::get('payment_taxadvisor_filter_month'))
|
||||
->where('user_invoices.year', '=', Request::get('payment_taxadvisor_filter_year'));
|
||||
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$query = $this->initSearch();
|
||||
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (UserInvoice $UserInvoice) {
|
||||
return $UserInvoice->id;
|
||||
|
||||
})
|
||||
|
||||
->addColumn('turnover', function (UserInvoice $UserInvoice) {
|
||||
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
|
||||
})
|
||||
->addColumn('debit_credit_indicator', function (UserInvoice $UserInvoice) {
|
||||
return "H";
|
||||
})
|
||||
->addColumn('account', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order && $UserInvoice->shopping_order->shopping_user){
|
||||
$key = strtoupper(substr($UserInvoice->shopping_order->shopping_user->billing_lastname, 0, 1));
|
||||
if($key === "S"){
|
||||
if(strtoupper(substr($UserInvoice->shopping_order->shopping_user->billing_lastname, 0, 3)) === "SCH"){
|
||||
return $this->accountKey['SCH'];
|
||||
}
|
||||
}
|
||||
return isset($this->accountKey[$key]) ? $this->accountKey[$key] : $key;
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('contra_account', function (UserInvoice $UserInvoice) {
|
||||
return "-";
|
||||
})
|
||||
->addColumn('bu_key', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order){
|
||||
return $UserInvoice->shopping_order->country_id;
|
||||
}
|
||||
})
|
||||
->addColumn('voucher_date', function (UserInvoice $UserInvoice) {
|
||||
// 101 -> für 01 Januar
|
||||
return $UserInvoice->month."01";
|
||||
})
|
||||
->addColumn('document_field_1', function (UserInvoice $UserInvoice) {
|
||||
//Rechnungsnummer
|
||||
return $UserInvoice->full_number;
|
||||
})
|
||||
->addColumn('posting_text', function (UserInvoice $UserInvoice) {
|
||||
//Buchungstext – hier wäre es toll wenn der Name des Kunden steht.
|
||||
if($UserInvoice->shopping_order && $UserInvoice->shopping_order->shopping_user){
|
||||
return $UserInvoice->shopping_order->shopping_user->billing_firstname." ".$UserInvoice->shopping_order->shopping_user->billing_lastname;
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('invoice', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
return $ret;
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('invoice_number', 'invoice_number $1')
|
||||
->orderColumn('turnover', 'turnover $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'shipping_order', 'turnover', 'total_shipping', 'status', 'txaction', 'invoice'])
|
||||
->make(true);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -182,10 +182,10 @@ class ProductController extends Controller
|
|||
]);
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
\Session()->flash('alert-success', __('msg.file_uploaded'));
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
\Session()->flash('alert-danger', __('msg.file_empty'));
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
|
||||
}
|
||||
|
|
@ -206,11 +206,11 @@ class ProductController extends Controller
|
|||
|
||||
$product_image->delete();
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
\Session()->flash('alert-danger', __('msg.file_not_found'));
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class SalesController extends Controller
|
|||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
|
|
@ -145,6 +145,9 @@ class SalesController extends Controller
|
|||
public function customersDetail($id)
|
||||
{
|
||||
$ShoppingOrder = ShoppingOrder::find($id);
|
||||
if(!$ShoppingOrder){
|
||||
abort(404);
|
||||
}
|
||||
if( $ShoppingOrder->payment_for !== 6 && $ShoppingOrder->payment_for !== 7){
|
||||
return redirect(route('admin_sales_users_detail', [$ShoppingOrder->id]));
|
||||
abort(403, 'Beraterbestellung');
|
||||
|
|
|
|||
|
|
@ -97,15 +97,15 @@ class SitesController extends Controller
|
|||
$model->iq_image_id = $iq_image->id;
|
||||
$model->save();
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
\Session()->flash('alert-success', __('msg.file_uploaded'));
|
||||
return redirect(route('admin_sites', [$model->slug]));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
\Session()->flash('alert-danger', __('msg.file_empty'));
|
||||
return redirect(route('admin_sites', [$model->slug]));
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
\Session()->flash('alert-danger', "Error: ".$e);
|
||||
return redirect(route('admin_sites', [$model->slug]));
|
||||
}
|
||||
}
|
||||
|
|
@ -124,11 +124,11 @@ class SitesController extends Controller
|
|||
$iq_image->delete();
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
return redirect(route('admin_sites', [$model->slug]));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
\Session()->flash('alert-danger', __('msg.file_not_found'));
|
||||
return redirect(route('admin_sites', [$model->slug]));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,12 @@ use App\Http\Controllers\Controller;
|
|||
use App\Services\SyS\ShoppingOrders;
|
||||
use App\Services\SyS\BuyingsProducts;
|
||||
use App\Services\SyS\BusinessStructur;
|
||||
use App\Services\SyS\ImportDbipCountry;
|
||||
use App\Services\SyS\ChangeUserBusinesses;
|
||||
use App\Services\SyS\UserCreditItemsAddFrom;
|
||||
use App\Services\SyS\RepairSalesVolumeInvoice;
|
||||
use App\Services\SyS\CleanHTMLProductDescription;
|
||||
use App\Services\SyS\UserCreditItemsChangeMessage;
|
||||
|
||||
class SysController extends Controller
|
||||
{
|
||||
|
|
@ -35,7 +40,9 @@ class SysController extends Controller
|
|||
{
|
||||
switch ($serve) {
|
||||
|
||||
|
||||
case 'user_credit_items_add_from':
|
||||
return UserCreditItemsAddFrom::show();
|
||||
break;
|
||||
case 'buyings_products':
|
||||
return BuyingsProducts::show();
|
||||
break;
|
||||
|
|
@ -66,6 +73,22 @@ class SysController extends Controller
|
|||
case 'change_user_businesses':
|
||||
return ChangeUserBusinesses::show();
|
||||
break;
|
||||
case 'repair_sales_volume_invoice':
|
||||
return RepairSalesVolumeInvoice::show();
|
||||
break;
|
||||
case 'user_credit_items_change_message':
|
||||
return UserCreditItemsChangeMessage::show();
|
||||
break;
|
||||
case 'clean_html_product_description':
|
||||
return CleanHTMLProductDescription::show();
|
||||
break;
|
||||
case 'import_dbip_country_lite':
|
||||
return ImportDbipCountry::show();
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
abort(403, 'not found tool');
|
||||
|
|
@ -74,6 +97,9 @@ class SysController extends Controller
|
|||
public function store($serve)
|
||||
{
|
||||
switch ($serve) {
|
||||
case 'user_credit_items_add_from':
|
||||
return UserCreditItemsAddFrom::show();
|
||||
break;
|
||||
case 'buyings_products':
|
||||
return BuyingsProducts::store();
|
||||
break;
|
||||
|
|
@ -104,6 +130,18 @@ class SysController extends Controller
|
|||
case 'change_user_businesses':
|
||||
return ChangeUserBusinesses::store();
|
||||
break;
|
||||
case 'repair_sales_volume_invoice':
|
||||
return RepairSalesVolumeInvoice::store();
|
||||
break;
|
||||
case 'user_credit_items_change_message':
|
||||
return UserCreditItemsChangeMessage::store();
|
||||
break;
|
||||
case 'clean_html_product_description':
|
||||
return CleanHTMLProductDescription::store();
|
||||
break;
|
||||
case 'import_dbip_country_lite':
|
||||
return ImportDbipCountry::store();
|
||||
break;
|
||||
}
|
||||
abort(403, 'not found tool');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use Maatwebsite\Excel\Facades\Excel;
|
|||
use App\Services\BusinessPlan\ExportBot;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ProductsSalesController extends Controller
|
||||
class TaxAdvisorController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -28,10 +28,10 @@ class ProductsSalesController extends Controller
|
|||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2023),
|
||||
];
|
||||
return view('admin.product.salesvolume', $data);
|
||||
return view('admin.payment.taxadvisor', $data);
|
||||
}
|
||||
|
||||
public function download(){
|
||||
|
|
@ -39,7 +39,7 @@ class ProductsSalesController extends Controller
|
|||
if(Request::get('action') === "export"){
|
||||
$objects = $this->initSearch(false);
|
||||
$columns = [];
|
||||
$filename = "mivita-absatzmengen-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
|
||||
$filename = "mivita-absatzmengen-".session('payment_taxadvisor_filter_month').'_'.session('payment_taxadvisor_filter_year')."-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
|
|
@ -64,18 +64,18 @@ class ProductsSalesController extends Controller
|
|||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => intval(date('m'))]);
|
||||
if(!session('payment_taxadvisor_filter_month')){
|
||||
session(['payment_taxadvisor_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => intval(date('Y'))]);
|
||||
if(!session('payment_taxadvisor_filter_year')){
|
||||
session(['payment_taxadvisor_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(Request::get('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => Request::get('product_sales_vol_filter_month')]);
|
||||
if(Request::get('payment_taxadvisor_filter_month')){
|
||||
session(['payment_taxadvisor_filter_month' => Request::get('payment_taxadvisor_filter_month')]);
|
||||
}
|
||||
if(Request::get('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => Request::get('product_sales_vol_filter_year')]);
|
||||
if(Request::get('payment_taxadvisor_filter_year')){
|
||||
session(['payment_taxadvisor_filter_year' => Request::get('payment_taxadvisor_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ class ProductsSalesController extends Controller
|
|||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d');
|
||||
$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
$date_start = Carbon::parse('01.'.session('payment_taxadvisor_filter_month').'.'.session('payment_taxadvisor_filter_year'))->format('Y-m-d');
|
||||
$date_end = Carbon::parse('01.'.session('payment_taxadvisor_filter_month').'.'.session('payment_taxadvisor_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
|
|
@ -133,11 +133,13 @@ class ProductsSalesController extends Controller
|
|||
|
||||
$collection = $this->initSearch(true);
|
||||
|
||||
/*
|
||||
$collect = collect([
|
||||
['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
|
||||
['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
|
||||
['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
|
||||
]);
|
||||
*/
|
||||
|
||||
return \DataTables::of($collection)->toJson();
|
||||
|
||||
|
|
@ -2,180 +2,258 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use File;
|
||||
use App\Models\Category;
|
||||
use Request;
|
||||
use App\Models\Product;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\Shipping;
|
||||
use App\Models\TransCategory;
|
||||
use App\Models\TransProduct;
|
||||
use App\Models\TransIngredient;
|
||||
use App\Models\TransShipping;
|
||||
use App\Models\TransUserLevel;
|
||||
use App\Models\UserLevel;
|
||||
use Illuminate\Support\Collection;
|
||||
use JoeDixon\Translation\Language;
|
||||
|
||||
|
||||
class TranslationController extends Controller
|
||||
{
|
||||
|
||||
|
||||
protected $languagesPath;
|
||||
protected $directory_separator;
|
||||
protected $from;
|
||||
protected $sourceLanguage;
|
||||
protected $selectLanguage;
|
||||
protected $selectKey;
|
||||
protected $keys;
|
||||
protected $model;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sourceLanguage = 'de';
|
||||
$this->selectLanguage = 'en';
|
||||
$this->keys = [];
|
||||
$this->model = "";
|
||||
}
|
||||
/**
|
||||
*/
|
||||
public function index($model, $lang=null)
|
||||
{
|
||||
//Request::get('key')
|
||||
//Request::get('language')
|
||||
$this->initByModel($model);
|
||||
$languages = $this->allLanguages();
|
||||
$languages->forget('de');
|
||||
|
||||
$this->directory_separator = DIRECTORY_SEPARATOR;
|
||||
$this->languagesPath = App::langPath();
|
||||
$translations = $this->getTranslationsFormModel();
|
||||
|
||||
$data = [
|
||||
'keys' => $this->keys,
|
||||
'languages' => $languages,
|
||||
'model' => $this->model,
|
||||
'select_language' => $this->selectLanguage,
|
||||
'source_language' => $this->sourceLanguage,
|
||||
'translations' => $translations,
|
||||
'select_key' => $this->selectKey
|
||||
];
|
||||
return view('translation::languages.translations.custom', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*/
|
||||
public function initByModel($model)
|
||||
{
|
||||
if($model === 'products'){
|
||||
$this->model = $model;
|
||||
$this->keys = [
|
||||
'name'=>'Produktname',
|
||||
'copy'=>'Produktbeschreibung',
|
||||
'description'=>'Beschreibung',
|
||||
'usage'=>'Anwendung',
|
||||
'ingredients'=>'Hinweise',
|
||||
];
|
||||
$this->selectKey = 'name';
|
||||
}
|
||||
|
||||
if($model === 'ingredients'){
|
||||
$this->model = $model;
|
||||
$this->keys = [
|
||||
'name'=>'Name',
|
||||
'inci'=>'INCI',
|
||||
'effect'=>'Wirkung',
|
||||
];
|
||||
$this->selectKey = 'name';
|
||||
}
|
||||
|
||||
if($model === 'user_levels'){
|
||||
$this->model = $model;
|
||||
$this->keys = [
|
||||
'name'=>'Name',
|
||||
];
|
||||
$this->selectKey = 'name';
|
||||
}
|
||||
|
||||
if($model === 'shippings'){
|
||||
$this->model = $model;
|
||||
$this->keys = [
|
||||
'name'=>'Name',
|
||||
];
|
||||
$this->selectKey = 'name';
|
||||
}
|
||||
|
||||
if($model === 'categories'){
|
||||
$this->model = $model;
|
||||
$this->keys = [
|
||||
'name'=>'Name',
|
||||
'headline'=>'Headline',
|
||||
];
|
||||
$this->selectKey = 'name';
|
||||
}
|
||||
|
||||
if(Request::get('key')){
|
||||
$this->selectKey = Request::get('key');
|
||||
}
|
||||
if(Request::get('language')){
|
||||
$this->selectLanguage = Request::get('language');
|
||||
}
|
||||
//Request::get('language')
|
||||
}
|
||||
|
||||
public function getTranslationsFormModel(){
|
||||
|
||||
if($this->model === 'products'){
|
||||
return Product::all()->mapWithKeys(function ($value) {
|
||||
return [$value->id => [
|
||||
'master' => $value->name,
|
||||
'source' => $value->{$this->selectKey},
|
||||
'trans' => $value->getTrans($this->selectKey, $this->selectLanguage),
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
if($this->model === 'ingredients'){
|
||||
return Ingredient::all()->mapWithKeys(function ($value) {
|
||||
return [$value->id => [
|
||||
'master' => $value->name,
|
||||
'source' => $value->{$this->selectKey},
|
||||
'trans' => $value->getTrans($this->selectKey, $this->selectLanguage),
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
if($this->model === 'user_levels'){
|
||||
return UserLevel::all()->mapWithKeys(function ($value) {
|
||||
return [$value->id => [
|
||||
'master' => $value->name,
|
||||
'source' => $value->{$this->selectKey},
|
||||
'trans' => $value->getTrans($this->selectKey, $this->selectLanguage),
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
if($this->model === 'shippings'){
|
||||
return Shipping::all()->mapWithKeys(function ($value) {
|
||||
return [$value->id => [
|
||||
'master' => $value->name,
|
||||
'source' => $value->{$this->selectKey},
|
||||
'trans' => $value->getTrans($this->selectKey, $this->selectLanguage),
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
if($this->model === 'categories'){
|
||||
return Category::all()->mapWithKeys(function ($value) {
|
||||
return [$value->id => [
|
||||
'master' => $value->name,
|
||||
'source' => $value->{$this->selectKey},
|
||||
'trans' => $value->getTrans($this->selectKey, $this->selectLanguage),
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function update($model)
|
||||
{
|
||||
$id = Request::get('key'); //id
|
||||
$key = Request::get('group'); //key colum
|
||||
$language = Request::get('language'); //selectLanguage
|
||||
|
||||
$value = Request::get('value') ?: ''; //value
|
||||
|
||||
if($model === 'products'){
|
||||
TransProduct::updateOrCreate([
|
||||
'language' => $language,
|
||||
'product_id' => $id,
|
||||
'key' => $key,
|
||||
], [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
if($model === 'ingredients'){
|
||||
TransIngredient::updateOrCreate([
|
||||
'language' => $language,
|
||||
'ingredient_id' => $id,
|
||||
'key' => $key,
|
||||
], [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
if($model === 'user_levels'){
|
||||
TransUserLevel::updateOrCreate([
|
||||
'language' => $language,
|
||||
'user_level_id' => $id,
|
||||
'key' => $key,
|
||||
], [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
if($model === 'shippings'){
|
||||
TransShipping::updateOrCreate([
|
||||
'language' => $language,
|
||||
'shipping_id' => $id,
|
||||
'key' => $key,
|
||||
], [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
if($model === 'categories'){
|
||||
TransCategory::updateOrCreate([
|
||||
'language' => $language,
|
||||
'categorie_id' => $id,
|
||||
'key' => $key,
|
||||
], [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
return ['success' => true];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all languages from the application.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Collection
|
||||
*/
|
||||
public function index()
|
||||
|
||||
public function allLanguages()
|
||||
{
|
||||
return redirect('admin/translate/all/edit/de');
|
||||
return Language::all()->mapWithKeys(function ($language) {
|
||||
return [$language->language => $language->name ?: $language->language];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $language
|
||||
* @param string $from
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function edit($language, $from = 'en')
|
||||
{
|
||||
$localisations = array_keys(config('localization.supportedLocales'));
|
||||
$files = $this->json_files($localisations);
|
||||
$translations = $this->translationsJson($language, $from);
|
||||
$show = "all";
|
||||
return view('translation.index', compact('files','translations', 'language', 'from', 'show'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $lang
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function update($language)
|
||||
{
|
||||
|
||||
|
||||
$path = $this->resourcePath($this->languagesPath);
|
||||
$file = $path.$language.".json";
|
||||
$data = Request::all();
|
||||
$this->backup($path, $language.".json");
|
||||
unset($data['_token']);
|
||||
|
||||
$ret = [];
|
||||
//file make keys
|
||||
$source = json_decode(File::get($path."de.json"));
|
||||
foreach ($source as $key => $v){
|
||||
$skey = $this->sanitize($key);
|
||||
if(!empty($data[$skey])) {
|
||||
$ret[$key] = $data[$skey];
|
||||
}
|
||||
}
|
||||
$jsonData = json_encode($ret, TRUE);
|
||||
file_put_contents($file, $jsonData);
|
||||
return redirect()
|
||||
->route('admin_translate_all_edit', [$language])
|
||||
->with('message', 'Translation added successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $langs
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function json_files($localisations){
|
||||
$path = $this->resourcePath($this->languagesPath);
|
||||
$content = array();
|
||||
foreach ($localisations as $local){
|
||||
$file = File::get($path.$local.".json");
|
||||
if($file){
|
||||
$content[$local] = array('path'=>$path.$local.".json", 'content'=>json_encode($file));
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $language
|
||||
* @param $from
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function translationsJson($language, $from)
|
||||
{
|
||||
$path = $this->resourcePath($this->languagesPath);
|
||||
$file = array();
|
||||
$file['keys'] = (array) json_decode(File::get($path."de.json"));
|
||||
$file['keys'] = $this->sanitizeKey($file['keys']);
|
||||
$file['from'] = (array) json_decode(File::get($path.$from.".json"));
|
||||
$file['from'] = $this->sanitizeKey($file['from']);
|
||||
$file['dest'] = (array) json_decode(File::get($path.$language.".json"));
|
||||
$file['dest'] = $this->sanitizeKey($file['dest']);
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function backup($path, $file)
|
||||
{
|
||||
|
||||
if (!File::exists(storage_path('language/'))) {
|
||||
File::makeDirectory(storage_path('language/'), 0755, true);
|
||||
}
|
||||
|
||||
return File::copy($path.$file, storage_path('language/'.time()."-".$file));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
protected function resourcePath($path)
|
||||
{
|
||||
return "{$path}{$this->directory_separator}";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $arr
|
||||
* @return mixed
|
||||
*/
|
||||
protected function sanitizeKey($arr){
|
||||
foreach ($arr as $key => $val){
|
||||
unset($arr[$key]);
|
||||
$arr[$this->sanitize($key)] = $val;
|
||||
}
|
||||
return $arr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $string
|
||||
* @param bool $force_lowercase
|
||||
* @param bool $anal
|
||||
* @return mixed|null|string|string[]
|
||||
*/
|
||||
protected function sanitize($string, $force_lowercase = true, $anal = false)
|
||||
{
|
||||
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]",
|
||||
"}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—",
|
||||
"—", "–", ",", "<", ".", ">", "/", "?");
|
||||
$clean = trim(str_replace($strip, "", strip_tags($string)));
|
||||
$clean = preg_replace('/\s+/', "_", $clean);
|
||||
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;
|
||||
|
||||
return ($force_lowercase) ?
|
||||
(function_exists('mb_strtolower')) ?
|
||||
mb_strtolower($clean, 'UTF-8') :
|
||||
strtolower($clean) :
|
||||
$clean;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,8 @@ class CustomerController extends Controller
|
|||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
|
||||
$data['language'] = isset($data['language']) ? $data['language'] : \App::getLocale();
|
||||
$data['faker_mail'] = isset($data['faker_mail']) ? true : false;
|
||||
$data['has_buyed'] = isset($data['has_buyed']) ? true : false;
|
||||
$data['subscribed'] = isset($data['subscribed']) ? true : false;
|
||||
|
|
@ -237,10 +239,12 @@ class CustomerController extends Controller
|
|||
if(Request::get('filter_member_id') != ""){
|
||||
$query->where('member_id', '=', Request::get('filter_member_id'));
|
||||
}*/
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('send_to', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->is_like ? '<span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> in Prüfung</span>' : '<a href="' . route('user_order_my_delivery', ['ot', $ShoppingUser->id]) . '" class="btn btn-sm btn-secondary"><span class="fa fa-shopping-cart"></span> wählen</a>';
|
||||
$ot = Request::get('isfor') ? Request::get('isfor') : 'ot-member';
|
||||
return $ShoppingUser->is_like ? '<span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> '.__('customer.under_review').'</span>' : '<a href="' . route('user_order_my_delivery', [$ot, $ShoppingUser->id]) . '" class="btn btn-sm btn-secondary"><span class="fa fa-shopping-cart"></span> '.__('customer.select').'</a>';
|
||||
})
|
||||
->addColumn('billing_email', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->faker_mail ? "-" : $ShoppingUser->billing_email;
|
||||
|
|
@ -264,7 +268,7 @@ class CustomerController extends Controller
|
|||
return get_active_badge($ShoppingUser->subscribed);
|
||||
})
|
||||
->addColumn('status', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->is_like ? '<span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> in Prüfung</span> ' : '<span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> zugewiesen</span>';
|
||||
return $ShoppingUser->is_like ? '<span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> '.__('customer.under_review').'</span> ' : '<span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> '.__('customer.assigned').'</span>';
|
||||
})
|
||||
->addColumn('extras', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->wp_order_number.($ShoppingUser->mode==='dev' ? ' <span class="badge badge-warning">dev</span>' : '');
|
||||
|
|
|
|||
131
app/Http/Controllers/User/DocumentsController.php
Normal file
131
app/Http/Controllers/User/DocumentsController.php
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Models\File;
|
||||
use App\Mail\MailReleaseDocument;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\FileRepository;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
|
||||
class DocumentsController extends Controller
|
||||
{
|
||||
protected $fileRepo;
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(FileRepository $fileRepo)
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->fileRepo = $fileRepo;
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'business_license_choose' => $user->account->getNotice('business_license'),
|
||||
];
|
||||
return view('user.documents.index', $data);
|
||||
|
||||
}
|
||||
|
||||
public function store($action){
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
|
||||
if ($action == 'verification') {
|
||||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('msg.no_id_card_deposited_please_upload_first'));
|
||||
$user->save();
|
||||
return redirect(route('user_documents'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$user->save();
|
||||
return redirect(route('user_documents'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'id_card');
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
if ($action == 'business_license') {
|
||||
if(Request::get('submit') === 'do'){
|
||||
$data = Request::all();
|
||||
|
||||
if($data['business_license_choose'] === "now"){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('msg.no_trade_licence_deposited_please_upload_first'));
|
||||
$user->save();
|
||||
return redirect(route('user_documents'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$user->account->setNotice('business_license_reason', '');
|
||||
|
||||
}
|
||||
if($data['business_license_choose'] === "later"){
|
||||
$user->account->setNotice('business_license_reason', '');
|
||||
|
||||
}
|
||||
if($data['business_license_choose'] === "non"){
|
||||
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('msg.please_enter_reason_why_you_not_need_trade_licence'));
|
||||
$user->save();
|
||||
return redirect(route('user_documents'))->withErrors($validator)->withInput(Request::all());
|
||||
}else{
|
||||
$user->account->setNotice('business_license_reason', $data['non_business_license_reason']);
|
||||
}
|
||||
}
|
||||
$user->account->setNotice('business_license', $data['business_license_choose']);
|
||||
$user->save();
|
||||
|
||||
if($user->isTestMode()){
|
||||
$mail = config('app.info_test_mail');
|
||||
}else{
|
||||
$mail = config('app.info_mail');
|
||||
}
|
||||
|
||||
Mail::to($mail)->locale($user->getLocale())->send(new MailReleaseDocument($user));
|
||||
|
||||
return redirect(route('user_documents'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'business_license');
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete($id, $relation){
|
||||
|
||||
if($relation === 'upload'){
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
$file = $user->files()->findOrFail($id);
|
||||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
}
|
||||
145
app/Http/Controllers/User/DownloadController.php
Normal file
145
app/Http/Controllers/User/DownloadController.php
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use Request;
|
||||
use App\Models\DcTag;
|
||||
use App\Models\DcFile;
|
||||
use App\Models\DcFileTag;
|
||||
use App\Models\DcCategory;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
|
||||
class DownloadController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.account');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$files = DcFile::where('active', true)->orderBy('id', 'desc')->get(); //File::all();
|
||||
|
||||
$filter_list = $this->makeFilterList();
|
||||
$data = [
|
||||
'files' => $files,
|
||||
'filter_list' => $filter_list,
|
||||
'tag_ids' => array(),
|
||||
'resTagIds' => array(),
|
||||
'search' => false,
|
||||
|
||||
];
|
||||
|
||||
return view('user.downloadcenter.index', $data);
|
||||
}
|
||||
|
||||
public function search(){
|
||||
|
||||
$request = Request::all();
|
||||
|
||||
|
||||
if(Request::ajax()){
|
||||
|
||||
$request['tagIds'] = isset($request['tagIds']) ? $request['tagIds'] : array();
|
||||
$request['searchinput'] = isset($request['searchinput']) ? $request['searchinput'] : "";
|
||||
$tag_ids = $request['tagIds'];
|
||||
$searchTags = [];
|
||||
foreach ($tag_ids as $tags) {
|
||||
if($tags != "" && $tags != "0"){
|
||||
if(is_array($tags)){
|
||||
foreach ($tags as $tag) {
|
||||
array_push($searchTags, $tag);
|
||||
}
|
||||
}else{
|
||||
array_push($searchTags, $tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
$q = DcFile::with('fileTag')->where('active', 1);
|
||||
if($request['searchinput'] != ""){
|
||||
$q->where('original_name', 'LIKE', '%'.$request['searchinput'].'%');
|
||||
}
|
||||
if(count($searchTags) > 0){
|
||||
$q->whereHas('fileTag', function ($query) use ($searchTags){
|
||||
$query->whereIn('tag_id', $searchTags);
|
||||
});
|
||||
}
|
||||
|
||||
$files = $q->orderBy('id', 'desc')->get();
|
||||
$returnContentFiles = view('user.downloadcenter.content-files')->with('files', $files)->render();
|
||||
/* if(strlen($files) < 1){
|
||||
$returnContentFiles = "Keine Einträge vorhanden";
|
||||
}*/
|
||||
/*
|
||||
$resTagIds = array();
|
||||
foreach ($files as $file) {
|
||||
foreach ($file->fileTag as $tagId) {
|
||||
if(empty($resTagIds[$tagId->tag_id])){
|
||||
$resTagIds[$tagId->tag_id] = 1;
|
||||
}else{
|
||||
$resTagIds[$tagId->tag_id]++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$categories = DcCategory::orderBy('pos')->get();
|
||||
$data = [
|
||||
'categories' => $categories,
|
||||
'tag_ids' => $tag_ids,
|
||||
'resTagIds' => $resTagIds,
|
||||
'search' => true,
|
||||
];
|
||||
$returnFilters = view('content-collapse')->with('data', $data)->render();
|
||||
*/
|
||||
$returnFilters = "";
|
||||
return response()->json( array('success' => true, 'request' => $request, 'searchTags' => $searchTags, 'content_files'=>$returnContentFiles, 'content_filter'=>$returnFilters) );
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
|
||||
/* if(!session('user_shop_api_orders_filter')){
|
||||
session(['user_shop_api_orders_filter' => 1]);
|
||||
}
|
||||
if(Request::get('user_shop_api_orders_filter')){
|
||||
session(['user_shop_api_orders_filter' => Request::get('user_shop_api_orders_filter')]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
private function makeFilterList($archive = false, $request = true)
|
||||
{
|
||||
$ret = [];
|
||||
$categories = DcCategory::where('active', true)->orderBy('pos')->get();
|
||||
foreach($categories as $category){
|
||||
$tags = DcTag::where('category_id', $category->id)->where('active', true)->orderBy('pos')->get();
|
||||
$items = [];
|
||||
foreach ($tags as $tag){
|
||||
//has file tags
|
||||
$count = DcFileTag::with('dc_file')->where('tag_id', $tag->id)->whereHas('dc_file', function ($query){
|
||||
$query->where('active', true);
|
||||
})->count();
|
||||
if($count > 0){
|
||||
$tag->count = $count;
|
||||
$items[] = $tag;
|
||||
}
|
||||
}
|
||||
if(isset($items) && count($items) > 0){
|
||||
$ret[$category->id]['items'] = $items;
|
||||
$ret[$category->id]['name'] = $category->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -42,7 +42,6 @@ class HomepartyController extends Controller
|
|||
$homeparty = new Homeparty();
|
||||
$homeparty->id = 0;
|
||||
$step = 1;
|
||||
$homeparty->description = "Willkommen zu unserer Auszeitparty rund um das Thema Bio Aloe Vera und Naturkosmetik. Wir informieren Dich darüber, was Premiumqualität bei Naturkosmetik wirklich ausmacht, zeigen Dir viele Anwendungsbeispiele bei Haut- und Darmproblemen und natürlich kannst Du unsere Produkte ausgiebig testen. Wir freuen uns auf Dich!";
|
||||
}else{
|
||||
$homeparty = $this->getHomparty($id);
|
||||
if($homeparty->step < 10){
|
||||
|
|
@ -76,6 +75,7 @@ class HomepartyController extends Controller
|
|||
public function store($id = null, $step = false)
|
||||
{
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'homeparty-party-store-detail'){
|
||||
$rules = array(
|
||||
'date' => 'required',
|
||||
|
|
@ -130,6 +130,7 @@ class HomepartyController extends Controller
|
|||
$data['step'] = 2;
|
||||
$step = 2;
|
||||
$homeparty = Homeparty::create($data);
|
||||
$this->storeTranslations($homeparty, \App::getLocale(), $data);
|
||||
$homeparty_user = HomepartyUser::create([
|
||||
'homeparty_id' => $homeparty->id,
|
||||
'auth_user_id' => \Auth::user()->id,
|
||||
|
|
@ -141,6 +142,7 @@ class HomepartyController extends Controller
|
|||
}else {
|
||||
$homeparty = $this->getHomparty($id);
|
||||
$homeparty->fill($data)->save();
|
||||
$this->storeTranslations($homeparty, \App::getLocale(), $data);
|
||||
$step = 10;
|
||||
}
|
||||
}
|
||||
|
|
@ -174,6 +176,20 @@ class HomepartyController extends Controller
|
|||
return redirect(route('user_homeparty_detail', [$homeparty->id, $step]));
|
||||
}
|
||||
|
||||
private function storeTranslations($homeparty, $lang, $data){
|
||||
|
||||
if($lang == 'de'){
|
||||
$homeparty->description = $data['description'];
|
||||
$homeparty->save();
|
||||
return;
|
||||
}
|
||||
$trans = $homeparty->trans_description;
|
||||
$trans[$lang] = $data['description'];
|
||||
$homeparty->trans_description = $trans;
|
||||
$homeparty->save();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function guests($id = null)
|
||||
{
|
||||
|
|
@ -269,7 +285,7 @@ class HomepartyController extends Controller
|
|||
}
|
||||
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
|
||||
if($this->userChangeCountry($homeparty)){
|
||||
\Session()->flash('custom-error', 'Das Rechnungsland wurde geändert und der Warenkrob zurückgesetzt.');
|
||||
\Session()->flash('custom-error', __('msg.country_account_has_been_changed__cost_has_been_reset'));
|
||||
return redirect(route('user_homeparty_order', [$homeparty->id]));
|
||||
}
|
||||
HomepartyCart::calculateHomeparty($homeparty);
|
||||
|
|
@ -450,7 +466,7 @@ class HomepartyController extends Controller
|
|||
|
||||
HomepartyCart::calculateHomeparty($homeparty);
|
||||
if(\App\Services\HomepartyCart::$price === 0){
|
||||
\Session()->flash('alert-error', 'Dein Warenkorb ist leer, bitte füge erst Produkte hinzu.');
|
||||
\Session()->flash('alert-error', __('msg.your_shopping_cart_is_empty_please_add_products_first'));
|
||||
return redirect(route('user_homeparty_order', [$homeparty->id]));
|
||||
}
|
||||
|
||||
|
|
@ -490,9 +506,10 @@ class HomepartyController extends Controller
|
|||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for nuy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'payment' => 5, //Berater Membership
|
||||
'payment' => 5, //Berater Homeparty
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
|
|
@ -524,7 +541,7 @@ class HomepartyController extends Controller
|
|||
}
|
||||
//$homeparty_user->save();
|
||||
$homeparty_user->delete();
|
||||
\Session()->flash('alert-success', "Auszeitparty Gast gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.homeparty_guest_delete'));
|
||||
return redirect(route('user_homeparty_guests', [$homeparty->id]));
|
||||
|
||||
}
|
||||
|
|
@ -547,7 +564,7 @@ class HomepartyController extends Controller
|
|||
}
|
||||
}
|
||||
$homeparty->delete();
|
||||
\Session()->flash('alert-success', "Auszeitparty gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.homeparty_delete'));
|
||||
return redirect(route('user_homepartys'));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use Auth;
|
||||
use Util;
|
||||
use Yard;
|
||||
use Carbon;
|
||||
use Config;
|
||||
use Request;
|
||||
use App\User;
|
||||
use App\Mail\MailInfo;
|
||||
|
|
@ -15,8 +14,8 @@ use App\Models\UserHistory;
|
|||
use App\Services\UserService;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use Illuminate\Validation\Rules\In;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
|
||||
class MembershipController extends Controller
|
||||
|
|
@ -96,10 +95,10 @@ class MembershipController extends Controller
|
|||
$user->account->payment_data = null;
|
||||
$user->account->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'abo_options_remove', 'status'=>10]);
|
||||
\Session()->flash('alert-success', "Abo-Option deaktiviert");
|
||||
\Session()->flash('alert-success', __('msg.abo_deaktivert'));
|
||||
return back();
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler, Checkbox nicht bestätigt.");
|
||||
\Session()->flash('alert-error', __('msg.error_checkbox_not_confirm'));
|
||||
return back();
|
||||
}
|
||||
//#### payment order
|
||||
|
|
@ -111,8 +110,8 @@ class MembershipController extends Controller
|
|||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
$showAboOptions = false;
|
||||
if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$showAboOptions = false; //true Abo Option deaktivert
|
||||
$user->abo_options = false; //true Abo Option deaktivert
|
||||
$user->save();
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +154,7 @@ class MembershipController extends Controller
|
|||
'payment' => 3, //Berater Membership
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
|
|
@ -174,14 +174,14 @@ class MembershipController extends Controller
|
|||
$user = User::find(Auth::user()->id);
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
if($user->payment_order_id == $product->id){
|
||||
\Session()->flash('alert-success', "keine Änderung vorgenommen.");
|
||||
\Session()->flash('alert-success', __('msg.no_change_made'));
|
||||
return back();
|
||||
}
|
||||
if($product && $product->active){
|
||||
$user->payment_order_id = $product->id;
|
||||
$user->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>10, 'product_id'=>$product->id]);
|
||||
\Session()->flash('alert-success', "gebuchtes Paket wurde geändert.");
|
||||
\Session()->flash('alert-success', __('msg.booked_package_has_been_changed'));
|
||||
return back();
|
||||
|
||||
}
|
||||
|
|
@ -198,10 +198,10 @@ class MembershipController extends Controller
|
|||
}
|
||||
Mail::to($mail)->send(new MailInfo($user, 'delete_membership'));
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>50]);
|
||||
\Session()->flash('alert-success', "Mitgliedschaft beenden ist beantragt");
|
||||
\Session()->flash('alert-success', __('msg.cancel_membership_is_requested'));
|
||||
return back();
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler, Checkbox nicht bestätigt.");
|
||||
\Session()->flash('alert-error', __('msg.error_checkbox_not_confirm'));
|
||||
return back();
|
||||
|
||||
}
|
||||
|
|
@ -2,23 +2,25 @@
|
|||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Auth;
|
||||
use Yard;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\UserService;
|
||||
use App\Mail\MailCustomPaymet;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserShop;
|
||||
use App\Services\Payment;
|
||||
use App\Services\UserService;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Request;
|
||||
use Validator;
|
||||
use Yard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
|
|
@ -85,7 +87,7 @@ class OrderController extends Controller
|
|||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
|
|
@ -109,29 +111,31 @@ class OrderController extends Controller
|
|||
->make(true);
|
||||
}
|
||||
|
||||
/*
|
||||
$for = me, ot-member, ot-customer, abo-ot-member, abo-ot-customer, abo-me
|
||||
*/
|
||||
|
||||
public function delivery($for, $id=null)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
if(!$this->checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
|
||||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
if(!Shop::checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
|
||||
$country = Shop::getDeliveryCountry($for, $delivery_id);
|
||||
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
}
|
||||
|
||||
if(Request::get('action') === 'next'){
|
||||
Yard::instance('shopping')->destroy();
|
||||
if(Request::get('switchers-radio-is-for') === 'ot'){
|
||||
if(strpos(Request::get('switchers-radio-is-for'), 'ot') !== false){
|
||||
$delivery_id = $id;
|
||||
}
|
||||
return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id]));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => false,
|
||||
|
|
@ -144,31 +148,36 @@ class OrderController extends Controller
|
|||
|
||||
public function list($for, $id=null)
|
||||
{
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
}
|
||||
$shipping_country_id = $this->checkShoppingCountry($for, $id);
|
||||
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
|
||||
//Liederung an (abo-) ot-customer (Kunden) Zahlung und Rechnung geht an Kunden
|
||||
UserService::initCustomerYard($shopping_user, $for);
|
||||
}else{
|
||||
//Lieferung an user oder (abo-) ot-member (Kunden) rechnung geht an User
|
||||
//lieferland und rechnungsland prüfen
|
||||
$shipping_country_id = Shop::checkShoppingCountry($for, $id);
|
||||
if(!$shipping_country_id){
|
||||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
$country = Shop::getDeliveryCountry($for, $id);
|
||||
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
|
||||
Yard::instance('shopping')->setUserPriceInfos(UserService::getYardInfo());
|
||||
|
||||
|
||||
UserService::initUserYard($user, $shipping_country_id, $for);
|
||||
}
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'user' => $user,
|
||||
'isAdmin' => false,
|
||||
'isView' => 'customer',
|
||||
'for' => $for,
|
||||
'template' => str_replace('abo-', '', $for),
|
||||
'delivery_id' => $delivery_id,
|
||||
'is_abo' => strpos($for, 'abo') !== false,
|
||||
'comp_products' => $this->getCompProducts($for),
|
||||
];
|
||||
return view('user.order.list', $data);
|
||||
|
|
@ -187,20 +196,21 @@ class OrderController extends Controller
|
|||
'shipping_state' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
//hier prüfen, ob versand etc richtig berechnet wurde
|
||||
$this->checkSendYardForPayment($data, $id);
|
||||
|
||||
if(Yard::instance('shopping')->getNumComp() > 0){
|
||||
if(!isset($data['switchers-comp-product'])){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
|
||||
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
|
||||
}else{
|
||||
if(!is_array($data['switchers-comp-product'])){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
|
||||
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
|
||||
}else{
|
||||
if(count($data['switchers-comp-product']) !== Yard::instance('shopping')->getNumComp()){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle :count Kompensationsprodukte aus', ['count'=>Yard::instance('shopping')->getNumComp()]));
|
||||
$validator->errors()->add('switchers-comp-product', __('mdg.please_select_count_compensation_products', ['count'=>Yard::instance('shopping')->getNumComp()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -213,11 +223,35 @@ class OrderController extends Controller
|
|||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
$data['is_from'] = 'user_order';
|
||||
$data['is_for'] = $for;
|
||||
$data['is_abo'] = $data['is_abo'] ?? 0;
|
||||
$data['abo_interval'] = $data['abo_interval'] ?? 0;
|
||||
$data['shopping_user_id'] = $id;
|
||||
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
|
||||
unset($data['quantity']);
|
||||
unset($data['_token']);
|
||||
$data['mode'] = 'live';
|
||||
|
||||
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user->shop->id,
|
||||
'payment' => 6, //Berater Shop to Customer Shop
|
||||
'subdomain' => $user->shop->getSubdomain(),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);
|
||||
$yard_shopping_items = Shop::getYardShoppingItems();
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
// send Mail to Customer
|
||||
$this->customPaymentSendMail($user, $identifier, $yard_shopping_items, $data);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_customer', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
|
||||
|
||||
//eine Abschließen bestellseite für den User + Link zum Kunden Shop + Mail an den Kunden / Berater
|
||||
return redirect(route('user_order_my_custom_payment', ['identifier'=>$identifier]));
|
||||
}else{
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for buy intern
|
||||
|
|
@ -225,80 +259,134 @@ class OrderController extends Controller
|
|||
'payment' => 2, //Berater Shop
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'abo_options'=>0]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkShoppingCountry($for, $id=null){
|
||||
private function checkSendYardForPayment($data, $id){
|
||||
|
||||
$country_id = null;
|
||||
if($for === 'me'){
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if($user->account->same_as_billing){
|
||||
$country_id = $user->account->country_id;
|
||||
}else{
|
||||
$country_id = $user->account->shipping_country_id;
|
||||
$shopping_user = null;
|
||||
if(strpos($data['shipping_is_for'], 'ot') !== false){
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
}
|
||||
|
||||
$shipping_country_id = Shop::checkShoppingCountry($data['shipping_is_for'], $id);
|
||||
if(!$shipping_country_id){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'no shipping_country_id found | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_country_was_not_found'));
|
||||
}
|
||||
//must be the same shipping country
|
||||
if($shipping_country_id != Yard::instance('shopping')->getShippingCountryId()){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'shipping_country_id is not the same from Yard | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_country_was_not_correctly'));
|
||||
}
|
||||
|
||||
if($data['shipping_is_for'] !== 'ot-customer'){
|
||||
if(Yard::instance('shopping')->shipping_free){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard can by not shipping_free | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shopping_cart_was_shipping_free'));
|
||||
}
|
||||
}
|
||||
if($for === 'ot' && $id){
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->same_as_billing){
|
||||
$country_id = $shopping_user->billing_country_id;
|
||||
}else{
|
||||
$country_id = $shopping_user->shipping_country_id;
|
||||
|
||||
if($data['shipping_is_for'] === 'ot-customer'){
|
||||
if(!$user->shop){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'User has no Shop for an User to Customer order| Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shopping_cart_was_not_user_shop'));
|
||||
}
|
||||
}
|
||||
if($country_id){
|
||||
if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){
|
||||
if($shipping_country->shipping && $shipping_country->shipping->active){
|
||||
return $shipping_country->id;
|
||||
|
||||
$shipping_price = Shop::getShippingPriceByShippingCountryId($shipping_country_id, Yard::instance('shopping')->weight());
|
||||
//for other and has weight - check
|
||||
if(strpos($data['shipping_is_for'], 'ot') !== false && $data['shipping_is_for'] !== 'ot-customer' && Yard::instance('shopping')->weight() > 0){
|
||||
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is 0 or | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_cost_cannot_be_0'));
|
||||
}
|
||||
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
|
||||
}
|
||||
}
|
||||
|
||||
if(($data['shipping_is_for'] == 'me' || $data['shipping_is_for'] == 'abo-me') && Yard::instance('shopping')->weight() > 0){
|
||||
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is 0 or | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_cost_cannot_be_0'));
|
||||
}
|
||||
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price_comp){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
|
||||
}
|
||||
|
||||
if(Yard::instance('shopping')->getNumComp() != $shipping_price->num_comp){
|
||||
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$data['user_id'] = Auth::user()->id;
|
||||
$data['shopping_user_id'] = $id;
|
||||
\App\Services\MyLog::writeLog('payment', 'error', 'Yard num_comp is 0 | Yard identifier: '.$identifier, $data);
|
||||
abort(403, __('msg.compensation_products_cannot_be_0'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkShoppingUser($id, $user){
|
||||
if($id === null){
|
||||
abort(403, 'Error: Keine User ID');
|
||||
}
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id !== $user->id){
|
||||
abort(403, 'Error: Falsche User ID');
|
||||
}
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->is_like){
|
||||
abort(403, 'Error: Kunde in Prüfung');
|
||||
}
|
||||
return $shopping_user;
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
if(Request::get('shipping_is_for') === 'me'){
|
||||
// $query = Product::with('product_buyings')->select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
|
||||
|
||||
if(Request::get('shipping_is_for') === 'me' || Request::get('shipping_is_for') === 'abo-me'){
|
||||
$show_on = Request::get('is_abo') ? '12' : '2';
|
||||
$query = Product::with('product_buyings')
|
||||
->select('products.*')->where('products.active', true)
|
||||
->whereJsonContains('products.show_on', '2')
|
||||
->whereJsonContains('products.show_on', $show_on)
|
||||
->whereDoesntHave('product_buyings', function ($q){
|
||||
$q->where('product_buyings.user_id', '=', \Auth::user()->id);
|
||||
});
|
||||
}else{
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '3');
|
||||
$show_on = Request::get('is_abo') ? '13' : '3';
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', $show_on);
|
||||
}
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
|
|
@ -306,7 +394,7 @@ class OrderController extends Controller
|
|||
$cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
|
||||
$qty = isset($cartItem->qty) ? $cartItem->qty : 0;
|
||||
$rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
|
||||
return '<strong>'.$product->name.'</strong><br>
|
||||
return '<strong>'.$product->getLang('name').'</strong><br>
|
||||
<div class="no-line-break input-group-min-w">
|
||||
<div class="input-group d-inline-flex w-auto">
|
||||
<span class="input-group-prepend">
|
||||
|
|
@ -358,6 +446,15 @@ class OrderController extends Controller
|
|||
->addColumn('price_vk_gross', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
|
||||
})
|
||||
->addColumn('customer_price_net', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry()).'</span>';
|
||||
})
|
||||
->addColumn('customer_price_gross', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
|
||||
})
|
||||
->addColumn('my_commission_net', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry(), true). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry(), true).'</span>';
|
||||
})
|
||||
->addColumn('action', function (Product $product) {
|
||||
return '<button class="btn btn-default btn-sm icon-btn md-btn-flat product-tooltip" title="details" data-modal="modal-lg"
|
||||
data-toggle="modal" data-target="#modals-load-content" data-id="'.$product->id.'" data-route="'.route('modal_load').'"
|
||||
|
|
@ -375,10 +472,13 @@ class OrderController extends Controller
|
|||
->orderColumn('price_net', 'price_net $1')
|
||||
->orderColumn('price_gross', 'price_gross $1')
|
||||
->orderColumn('price_vk_gross', 'price $1')
|
||||
->orderColumn('customer_price_net', 'price $1')
|
||||
->orderColumn('customer_price_gross', 'price $1')
|
||||
->orderColumn('my_commission_net', 'price $1')
|
||||
->orderColumn('contents_total', 'contents_total $1')
|
||||
->orderColumn('weight', 'weight $1')
|
||||
|
||||
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'product', 'quantity', 'picture', 'action'])
|
||||
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'customer_price_net', 'customer_price_gross', 'my_commission_net', 'product', 'quantity', 'picture', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +488,8 @@ class OrderController extends Controller
|
|||
if(Request::ajax()) {
|
||||
$data = Request::all();
|
||||
|
||||
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot';
|
||||
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot-member';
|
||||
$data['for'] = $is_for;
|
||||
$data['comp_products'] = $this->getCompProducts($is_for);
|
||||
|
||||
if($data['action'] === 'updateCart' && isset($data['product_id'])){
|
||||
|
|
@ -399,17 +500,28 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
//get the card item
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
if($is_for === 'ot-customer' || $is_for === 'abo-ot-customer'){
|
||||
$cartItem = Yard::instance('shopping')
|
||||
->add($product->id, $product->getLang('name'), 1,
|
||||
round($product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), 1), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
}else{
|
||||
$cartItem = Yard::instance('shopping')
|
||||
->add($product->id, $product->getLang('name'), 1,
|
||||
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), true, Yard::instance('shopping')->getUserCountry()), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
}
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
|
||||
|
||||
}
|
||||
if(isset($data['qty']) && $data['qty'] > 0){
|
||||
Yard::instance('shopping')->update($cartItem->rowId, $data['qty']);
|
||||
}else{
|
||||
//if 0 get the item by qty:1 and remove it
|
||||
Yard::instance('shopping')->remove($cartItem->rowId);
|
||||
}
|
||||
//
|
||||
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
|
|
@ -460,6 +572,7 @@ class OrderController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function updateCompProduct($data){
|
||||
//clear old
|
||||
foreach (Yard::instance('shopping')->content() as $row) {
|
||||
|
|
@ -485,9 +598,79 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
private function getCompProducts($for){
|
||||
if($for === 'me'){
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['1', '2', '3', '4'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
if(Shop::isCompProducts($for)){
|
||||
$show_on = '0';
|
||||
switch($for){
|
||||
case 'me':
|
||||
$show_on = '2';
|
||||
break;
|
||||
case 'abo-me':
|
||||
$show_on = '12';
|
||||
break;
|
||||
case 'ot-member':
|
||||
$show_on = '3';
|
||||
break;
|
||||
case 'ot-customer':
|
||||
$show_on = '3';
|
||||
break;
|
||||
case 'abo-ot-member':
|
||||
$show_on = '13';
|
||||
break;
|
||||
case 'abo-ot-customer':
|
||||
$show_on = '13';
|
||||
break;
|
||||
}
|
||||
return Product::whereActive(true)->where('shipping_addon', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'DESC')->get();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function customPayment($identifier){
|
||||
|
||||
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
|
||||
if(!$shopping_instance){
|
||||
abort(403, __('msg.shopping_instance_not_found'));
|
||||
}
|
||||
$shopping_data = $shopping_instance->shopping_data;
|
||||
$shopping_user = $shopping_data['shopping_user_id'] ? ShoppingUser::find($shopping_data['shopping_user_id']) : null;
|
||||
if(!$shopping_user){
|
||||
abort(403, __('msg.shopping_user_not_found'));
|
||||
}
|
||||
|
||||
$yard_shopping_items = Shop::getYardShoppingItems();
|
||||
|
||||
$data = [
|
||||
'shopping_instance' => $shopping_instance,
|
||||
'shopping_user' => $shopping_user,
|
||||
'yard_shopping_items' => $yard_shopping_items,
|
||||
'identifier' => $identifier,
|
||||
];
|
||||
return view('user.order.custom_payment', $data);
|
||||
}
|
||||
|
||||
|
||||
private static function customPaymentSendMail($user, $identifier, $yard_shopping_items, $data){
|
||||
$bcc = [];
|
||||
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
|
||||
if(!$shopping_instance){
|
||||
abort(403, __('msg.shopping_instance_not_found'));
|
||||
}
|
||||
$shopping_user = $data['shopping_user_id'] ? ShoppingUser::find($data['shopping_user_id']) : null;
|
||||
if(!$shopping_user){
|
||||
abort(403, __('msg.shopping_user_not_found'));
|
||||
}
|
||||
|
||||
$route = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
|
||||
$billing_email = $shopping_user->billing_email;
|
||||
if(!$billing_email){
|
||||
$billing_email = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
|
||||
}
|
||||
$bcc[] = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
|
||||
$bcc[] = $shopping_user->member ? $shopping_user->member->email : $user->email;
|
||||
|
||||
Mail::to($billing_email)->bcc($bcc)->locale(\App::getLocale())
|
||||
->send(new MailCustomPaymet($route, $shopping_user, $shopping_instance, $yard_shopping_items, $data['mode']));
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ use App\Models\UserCredit;
|
|||
use App\Models\UserPayCredit;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Auth;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
|
|
@ -48,7 +49,11 @@ class PaymentController extends Controller
|
|||
$ret = "";
|
||||
if(Credit::isCredit($UserCredit)){
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a><br>';
|
||||
if(Auth::user()->isVIP()){
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'html']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
|
||||
}
|
||||
}else{
|
||||
$ret = "-";
|
||||
}
|
||||
|
|
@ -61,7 +66,7 @@ class PaymentController extends Controller
|
|||
$ret = "";
|
||||
if($UserCredit->user_credit_items){
|
||||
foreach($UserCredit->user_credit_items as $user_credit_item){
|
||||
$ret .= nl2br($user_credit_item->message)." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
|
||||
$ret .= nl2br($user_credit_item->getTransMessage())." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +90,7 @@ class PaymentController extends Controller
|
|||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('message', function (UserCreditItem $user_credit_item) {
|
||||
return nl2br($user_credit_item->message);
|
||||
return nl2br($user_credit_item->getTransMessage());
|
||||
})
|
||||
->addColumn('credit', function (UserCreditItem $user_credit_item) {
|
||||
return formatNumber($user_credit_item->credit)." €";
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class ShopApiController extends Controller
|
|||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
|
||||
})
|
||||
->addColumn('api_status', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->api_status === 2){
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ use Maatwebsite\Excel\Facades\Excel;
|
|||
use App\Services\BusinessPlan\ExportBot;
|
||||
use App\Services\BusinessPlan\TreeCalcBot;
|
||||
|
||||
use function Ramsey\Uuid\v1;
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
|
||||
|
|
@ -45,7 +47,7 @@ class TeamController extends Controller
|
|||
//for testing
|
||||
//$TreeCalcBot->initUser(56);
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
'TreeCalcBot' => $TreeCalcBot,
|
||||
];
|
||||
|
|
@ -59,7 +61,7 @@ class TeamController extends Controller
|
|||
$userSalesVolume = $user->getUserSalesVolume(intval(session('team_user_points_filter_month')), intval(session('team_user_points_filter_year')), 'first');
|
||||
$data = [
|
||||
'userSalesVolume' => $userSalesVolume,
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
];
|
||||
return view('user.team.points', $data);
|
||||
|
|
@ -69,6 +71,9 @@ class TeamController extends Controller
|
|||
{
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if(!$user->isVIP()){
|
||||
abort(404);
|
||||
}
|
||||
$ExportBot = new ExportBot('member');
|
||||
$ExportBot->initStructureUser($user, 'list'); //tree or list
|
||||
$data = [
|
||||
|
|
@ -84,44 +89,44 @@ class TeamController extends Controller
|
|||
$ExportBot = new ExportBot('member');
|
||||
$ExportBot->initStructureUser($user, 'list'); //tree or list
|
||||
$columns = [];
|
||||
$filename = "mivita-mein-team-export-".date('Y-m-d-H-i-s');
|
||||
$filename = __('team.filename_export').date('Y-m-d-H-i-s');
|
||||
$headers = array(
|
||||
'Line',
|
||||
'Level',
|
||||
'E-Mail',
|
||||
'Vorname',
|
||||
'Nachname',
|
||||
'Adresse',
|
||||
'Zusatz',
|
||||
'PLZ',
|
||||
'Ort',
|
||||
'Land',
|
||||
'Tel',
|
||||
'Mobil',
|
||||
'Geburtstag',
|
||||
'Account',
|
||||
'Account bis',
|
||||
'Sponsor',
|
||||
__('tables.line'),
|
||||
__('tables.level'),
|
||||
__('tables.email'),
|
||||
__('tables.firstname'),
|
||||
__('tables.lastname'),
|
||||
__('tables.address'),
|
||||
__('tables.addition'),
|
||||
__('tables.postcode'),
|
||||
__('tables.city'),
|
||||
__('tables.country'),
|
||||
__('tables.phone'),
|
||||
__('tables.mobil'),
|
||||
__('tables.birthday'),
|
||||
__('tables.account'),
|
||||
__('tables.account_to'),
|
||||
__('tables.sponsor'),
|
||||
);
|
||||
if(isset($ExportBot->user_list->childs)){
|
||||
foreach ($ExportBot->user_list->childs as $child){
|
||||
$columns[] = array(
|
||||
'Line' => $child->line,
|
||||
'Level' => $child->level_name,
|
||||
'E-Mail' => $child->email,
|
||||
'Vorname' => $child->first_name,
|
||||
'Nachname' => $child->last_name,
|
||||
'Adresse' => $child->address,
|
||||
'Zusatz' => $child->address_2,
|
||||
'PLZ' => $child->zipcode,
|
||||
'Ort' => $child->city,
|
||||
'Land' => $child->country_id,
|
||||
'Tel' => $child->phone,
|
||||
'Mobil' => $child->mobil,
|
||||
'Geburtstag' => $child->birthday,
|
||||
'Account' => ($child->active_account == 1 ? 'JA' : 'NEIN'),
|
||||
'Account bis' => $child->payment_account_date,
|
||||
'Sponsor' => $child->sponsor_name,
|
||||
__('tables.line') => $child->line,
|
||||
__('tables.level') => $child->level_name,
|
||||
__('tables.email') => $child->email,
|
||||
__('tables.firstname') => $child->first_name,
|
||||
__('tables.lastname') => $child->last_name,
|
||||
__('tables.address') => $child->address,
|
||||
__('tables.addition') => $child->address_2,
|
||||
__('tables.postcode') => $child->zipcode,
|
||||
__('tables.city') => $child->city,
|
||||
__('tables.country') => $child->country_id,
|
||||
__('tables.phone') => $child->phone,
|
||||
__('tables.mobil') => $child->mobil,
|
||||
__('tables.birthday') => $child->birthday,
|
||||
__('tables.account') => ($child->active_account == 1 ? __('yes') : __('no')),
|
||||
__('tables.account_to') => $child->payment_account_date,
|
||||
__('tables.sponsor') => $child->sponsor_name,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -192,7 +197,9 @@ class TeamController extends Controller
|
|||
->addColumn('total_net', function (UserSalesVolume $UserSalesVolume) {
|
||||
return formatNumber($UserSalesVolume->total_net).' €';
|
||||
})
|
||||
|
||||
->addColumn('status_turnover', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusTurnoverColor().'">'.$UserSalesVolume->getStatusTurnoverType().'</span>';
|
||||
})
|
||||
->addColumn('status', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusColor().'">'.$UserSalesVolume->getStatusType().'</span>';
|
||||
})
|
||||
|
|
@ -209,7 +216,7 @@ class TeamController extends Controller
|
|||
->orderColumn('message', 'message $1')
|
||||
->orderColumn('info', 'info $1')
|
||||
|
||||
->rawColumns(['id', 'order', 'status', 'message', 'info', 'total_net'])
|
||||
->rawColumns(['id', 'order', 'status_turnover', 'status', 'message', 'info', 'total_net'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ class UserDataController extends Controller
|
|||
}*/
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['reverse_charge_validate'])){
|
||||
return $this->userRepo->reverse_charge_validate($data, $user);
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
return $this->userRepo->reverse_charge_validate($data, $user, route('user_edit', [$user->id]));
|
||||
}
|
||||
|
||||
if(isset($data['reverse_charge_delete'])){
|
||||
return $this->userRepo->reverse_charge_delete($data, $user);
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
return $this->userRepo->reverse_charge_delete($data, $user, route('user_edit', [$user->id]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
|
|
|
|||
|
|
@ -35,10 +35,9 @@ class UserShopController extends Controller
|
|||
if ($user->account) {
|
||||
$user->shop->contact = $this->generate_contact($user);
|
||||
} else {
|
||||
$user->shop->contact = "Deine Straße/Nr • Dein PLZ Ort\nFestnetz: Deine Festnetz-Nummer\nMobil: Deine Mobil-Nummer\nDeine E-Mail-Adresse";
|
||||
$user->shop->contact = __('shop.shop_contact_text');
|
||||
}
|
||||
|
||||
$user->shop->accessibility = "Mo-Fr: 9.00 - 19.00 Uhr\nSa-So: 11.00 - 18.00 Uhr";
|
||||
$user->shop->accessibility =__('shop.shop_accessibility_text');
|
||||
|
||||
}
|
||||
$data = [
|
||||
|
|
@ -48,6 +47,33 @@ class UserShopController extends Controller
|
|||
|
||||
}
|
||||
|
||||
public function translate()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'localizations' => array_keys(config('localization.supportedLocales')),
|
||||
|
||||
];
|
||||
return view('user.shop.translate', $data);
|
||||
|
||||
}
|
||||
|
||||
public function translateStore()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$data = Request::all();
|
||||
|
||||
if (!$user->shop) {
|
||||
abort(404);
|
||||
}
|
||||
foreach($data['trans'] as $lang => $val){
|
||||
$this->storeTranslations($user->shop, $lang, $val);
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('user_shop_translate'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
|
@ -57,35 +83,51 @@ class UserShopController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
$user->shop->title = $data['title'];
|
||||
$user->shop->contact = trim(preg_replace('/\s*\n+/',"\n", $data['contact']));
|
||||
$user->shop->accessibility = trim(preg_replace('/\s*\n+/',"\n", $data['accessibility']));
|
||||
$user->shop->about = trim(preg_replace('/\s+/', ' ',$data['about']));
|
||||
$user->shop->active = isset($data['active']) ? true : false;
|
||||
$user->shop->set_defaults = true;
|
||||
$user->shop->save();
|
||||
$this->storeTranslations($user->shop, \App::getLocale(), $data);
|
||||
\Session()->flash('alert-save', true);
|
||||
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
|
||||
private function storeTranslations($user_shop, $lang, $data){
|
||||
|
||||
if($lang == 'de'){
|
||||
$user_shop->contact = trim(preg_replace('/\s*\n+/',"\n", $data['contact']));
|
||||
$user_shop->accessibility = trim(preg_replace('/\s*\n+/',"\n", $data['accessibility']));
|
||||
$user_shop->about = trim(preg_replace('/\s+/', ' ',$data['about']));
|
||||
$user_shop->save();
|
||||
return;
|
||||
}
|
||||
$trans = $user_shop->trans;
|
||||
$trans[$lang]['contact'] = trim(preg_replace('/\s*\n+/',"\n", $data['contact']));
|
||||
$trans[$lang]['accessibility'] = trim(preg_replace('/\s*\n+/',"\n", $data['accessibility']));
|
||||
$trans[$lang]['about'] = trim(preg_replace('/\s+/', ' ',$data['about']));
|
||||
$user_shop->trans = $trans;
|
||||
$user_shop->save();
|
||||
return;
|
||||
}
|
||||
|
||||
private function generate_contact($user)
|
||||
{
|
||||
$ret = "";
|
||||
$sep = "\n";
|
||||
|
||||
$ret = $user->account->street != "" ? $user->account->street : "Deine Straße/Nr";
|
||||
$ret = $user->account->street != "" ? $user->account->street : __('shop.your_street_number');
|
||||
$ret .= " • ";
|
||||
$ret.= $user->account->postal_code != "" ? $user->account->postal_code." " : "Dein PLZ ";
|
||||
$ret.= $user->account->city != "" ? $user->account->city : "Dein Ort";
|
||||
$ret.= $user->account->postal_code != "" ? $user->account->postal_code." " : __('shop.your_zip_code');
|
||||
$ret.= $user->account->city != "" ? $user->account->city : __('shop.your_city');
|
||||
$ret.= $sep;
|
||||
|
||||
$pre = $user->account->pre_phone_id != "" ? $user->account->pre_phone->phone." " : "";
|
||||
$ret.= "Festnetz: ".($user->account->phone != "" ? $pre.$user->account->phone : "Deine Festnetz-Nummer");
|
||||
$ret.= __('shop.phone').": ".($user->account->phone != "" ? $pre.$user->account->phone : __('shop.your_phone_number'));
|
||||
$ret.= $sep;
|
||||
|
||||
$pre = $user->account->pre_mobil_id != "" ? $user->account->pre_mobil->phone." " : "";
|
||||
$ret.= "Mobil: ".($user->account->mobil != "" ? $pre.$user->account->mobil : "Deine Mobil-Nummer");
|
||||
$ret.= __('shop.mobil').": ".($user->account->mobil != "" ? $pre.$user->account->mobil : __('shop.your_mobile_number'));
|
||||
$ret.= $sep;
|
||||
|
||||
$ret.= $user->email;
|
||||
|
|
@ -138,15 +180,15 @@ class UserShopController extends Controller
|
|||
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
\Session()->flash('alert-success', __('msg.file_uploaded'));
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
\Session()->flash('alert-danger', __('msg.file_empty'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
\Session()->flash('alert-danger', "Error: ".$e);
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
}
|
||||
|
|
@ -170,11 +212,11 @@ class UserShopController extends Controller
|
|||
$user->shop->size = null;
|
||||
$user->shop->save();
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
\Session()->flash('alert-danger', __('msg.file_not_found'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
|
|
@ -223,15 +265,15 @@ class UserShopController extends Controller
|
|||
'size' => $image['input']['size']
|
||||
]);
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
\Session()->flash('alert-success', __('msg.file_uploaded'));
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
\Session()->flash('alert-danger', __('msg.file_empty'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
\Session()->flash('alert-danger', "Error: ".$e);
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
}
|
||||
|
|
@ -250,11 +292,11 @@ class UserShopController extends Controller
|
|||
|
||||
$image->delete();
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
\Session()->flash('alert-danger', __('msg.file_not_found'));
|
||||
return redirect(route('user_shop'));
|
||||
|
||||
}
|
||||
|
|
@ -345,9 +387,12 @@ class UserShopController extends Controller
|
|||
//check if exisist
|
||||
$subdomains = $kas->action('get_subdomains');
|
||||
foreach ($subdomains as $subdomain){
|
||||
if(!isset($subdomain['subdomain_name'])){
|
||||
continue;
|
||||
}
|
||||
$sub = str_replace(".".$domain, '', $subdomain['subdomain_name']);
|
||||
if($sub == $slug){
|
||||
return ['success' => false, 'error' => 'Fehler: Subdomain existierts bereits, bitte einen neues Namen wählen'];
|
||||
return ['success' => false, 'error' => __('shop.error_subdomain_exists')];
|
||||
}
|
||||
}
|
||||
//add
|
||||
|
|
@ -356,7 +401,7 @@ class UserShopController extends Controller
|
|||
'subdomain_name' => $slug,
|
||||
'domain_name' => $domain,
|
||||
'subdomain_path' => '/mein.mivita.care/public/',
|
||||
'php_version' => '7.3',
|
||||
'php_version' => config('app.php_version'),
|
||||
//'ssl_proxy' => 'Y',
|
||||
//'redirect_status' => 0
|
||||
);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class UserUpdateEmailController extends Controller
|
|||
public function sendActivationMail($user, array $data)
|
||||
{
|
||||
$token = $this->createActivation($user, $data);
|
||||
Mail::to($data['email'])->send(new MailActivateUser($token, $user));
|
||||
Mail::to($data['email'])->locale($user->getLocale())->send(new MailActivateUser($token, $user));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ class CardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
$cartItem = Yard::instance('shopping')
|
||||
->add($product->id, $product->getLang('name'), $quantity,
|
||||
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
|
|
@ -59,7 +62,10 @@ class CardController extends Controller
|
|||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
$cartItem = Yard::instance('shopping')
|
||||
->add($product->id, $product->getLang('name'), $quantity,
|
||||
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
|
||||
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
|
|
@ -117,17 +123,18 @@ class CardController extends Controller
|
|||
$data['is_from'] = 'shopping';
|
||||
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
|
||||
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment' => 1,
|
||||
'payment' => 1, //Customer Shop Payment
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);
|
||||
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use App\Services\Shop;
|
|||
use App\Services\Util;
|
||||
use App\Models\Homeparty;
|
||||
use App\Services\Payment;
|
||||
use App\Services\AboHelper;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\ShoppingOrder;
|
||||
|
|
@ -49,18 +50,14 @@ class CheckoutController extends Controller
|
|||
|
||||
$is_from = isset($shopping_data['is_from']) ? $shopping_data['is_from'] : 'shopping';
|
||||
$is_for = isset($shopping_data['is_for']) ? $shopping_data['is_for'] : false;
|
||||
$is_abo = isset($shopping_data['is_abo']) ? (bool) $shopping_data['is_abo'] : false;
|
||||
$abo_interval = isset($shopping_data['abo_interval']) ? $shopping_data['abo_interval'] : 0;
|
||||
if($is_for === 'ot-customer' || $is_for === 'abo-ot-customer'){
|
||||
$is_from = 'shopping';
|
||||
}
|
||||
$homeparty_id = isset($shopping_data['homeparty_id']) ? $shopping_data['homeparty_id'] : null;
|
||||
$shopping_user = null;
|
||||
|
||||
/*if(!$this->getPayments('shopping_user_id') && Util::getAuthUser()){//$is_from !== 'shopping' && ){ //
|
||||
|
||||
$shopping_user = $this->shoppingUserAuthData($is_from, $is_for, $shopping_data);
|
||||
// $shopping_user->save();
|
||||
// $this->putPayments('shopping_user_id', $shopping_user->id);
|
||||
|
||||
}else{
|
||||
$shopping_user = ShoppingUser::findOrNew($this->getPayments('shopping_user_id'));
|
||||
}*/
|
||||
if(\Session::has('new_session')){
|
||||
$this->destroy();
|
||||
\Session::forget('new_session');
|
||||
|
|
@ -73,12 +70,19 @@ class CheckoutController extends Controller
|
|||
$shopping_user = $this->shoppingUserAuthData($is_from, $is_for, $shopping_data);
|
||||
$shopping_user->save();
|
||||
$this->putPayments('shopping_user_id', $shopping_user->id);
|
||||
}elseif($is_from === 'shopping') {
|
||||
}elseif($is_from === 'shopping' && ($is_for !== 'ot-customer' || $is_for !== 'abo-ot-customer')){
|
||||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->is_for = $is_for;
|
||||
$shopping_user->is_from = $is_from;
|
||||
$shopping_user->homeparty_id = $homeparty_id;
|
||||
$shopping_user->mode = 'prev';
|
||||
$shopping_user->language = \App::getLocale();
|
||||
}elseif($is_from === 'shopping' && ($is_for === 'ot-customer' || $is_for === 'abo-ot-customer')){
|
||||
$shopping_user = $this->makeCustomerShoppingUser($shopping_data);
|
||||
$shopping_user->is_for = $is_for;
|
||||
$shopping_user->is_from = $is_from;
|
||||
$shopping_user->mode = 'prev';
|
||||
$shopping_user->language = \App::getLocale();
|
||||
}
|
||||
}else{
|
||||
$shopping_user = ShoppingUser::findOrFail($this->getPayments('shopping_user_id'));
|
||||
|
|
@ -105,16 +109,12 @@ class CheckoutController extends Controller
|
|||
$shopping_user->billing_state = Yard::instance('shopping')->getShippingCountryId();
|
||||
$shopping_user->shipping_state = Yard::instance('shopping')->getShippingCountryId();
|
||||
}
|
||||
|
||||
if(Util::getAuthUser()){
|
||||
$shopping_user->abo_options = Util::getUserHistoryValue('abo_options');
|
||||
//$shopping_user->save();
|
||||
}
|
||||
|
||||
$payment_methods = $this->getPaymentsMethods($is_from);
|
||||
$payment_methods = $this->getPaymentsMethods($is_from, $is_abo);
|
||||
$data = [
|
||||
'is_from' => $is_from,
|
||||
'is_for' => $is_for,
|
||||
'is_abo' => $is_abo,
|
||||
'abo_interval' => $abo_interval,
|
||||
'shopping_data' => $shopping_data,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'shopping_user' => $shopping_user,
|
||||
|
|
@ -126,24 +126,27 @@ class CheckoutController extends Controller
|
|||
return view('web.templates.checkout', $data);
|
||||
}
|
||||
|
||||
private function getPaymentsMethods($is_from){
|
||||
private function getPaymentsMethods($is_from, $is_abo = false){
|
||||
$payment_methods = [];
|
||||
if($is_from !== 'shopping' && Util::getAuthUser()){
|
||||
$user = Util::getAuthUser();
|
||||
$payment_methods['default'] = $user->payment_methods;
|
||||
$payment_methods['data'] = $user->account->payment_data;
|
||||
}else{
|
||||
$payment_methods['default'] = PaymentMethod::getDefaultAsArray()->toArray();
|
||||
$payment_methods['default'] = PaymentMethod::getDefaultAsArray($is_abo)->toArray();
|
||||
$payment_methods['data'] = false;
|
||||
}
|
||||
|
||||
if($is_abo){
|
||||
$payment_methods['active'] = \App\Models\PaymentMethod::where('active', true)->where('is_abo', true)->get()->pluck( 'id', 'short')->toArray();
|
||||
}else{
|
||||
$payment_methods['active'] = \App\Models\PaymentMethod::where('active', true)->get()->pluck( 'id', 'short')->toArray();
|
||||
}
|
||||
return $payment_methods;
|
||||
}
|
||||
|
||||
private function isPaymentsMethodsActive($payment_method, $is_from){
|
||||
private function isPaymentsMethodsActive($payment_method, $is_from, $is_abo = false){
|
||||
$payment_names = ['wlt#PPE' => 'PP', 'cc' => 'CC', 'sb#PNT' => 'SB', 'elv' => 'SEPA', 'vor' => 'VOR', 'fnc#MIV' => 'FNC'];
|
||||
$payment_methods = $this->getPaymentsMethods($is_from);
|
||||
$payment_methods = $this->getPaymentsMethods($is_from, $is_abo);
|
||||
if(isset($payment_names[$payment_method])){
|
||||
$payment_with = $payment_names[$payment_method];
|
||||
if(array_key_exists($payment_with, $payment_methods['active']) && in_array($payment_methods['active'][$payment_with], $payment_methods['default'])){
|
||||
|
|
@ -159,6 +162,7 @@ class CheckoutController extends Controller
|
|||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->auth_user_id = $user->id;
|
||||
$shopping_user->mode = 'prev';
|
||||
$shopping_user->language = \App::getLocale();
|
||||
|
||||
$shopping_user->billing_salutation = $user->account->salutation;
|
||||
$shopping_user->billing_company = $user->account->company;
|
||||
|
|
@ -182,7 +186,7 @@ class CheckoutController extends Controller
|
|||
|
||||
//Lieferadresse
|
||||
if($is_from === 'user_order'){
|
||||
if(isset($data['shopping_user_id']) && $data['is_for'] === 'ot'){
|
||||
if(isset($data['shopping_user_id']) && strpos($data['is_for'], 'ot') !== false){
|
||||
$s_user = ShoppingUser::findOrFail($data['shopping_user_id']);
|
||||
/* $shopping_user->billing_salutation = $s_user->billing_salutation;
|
||||
$shopping_user->billing_company = $s_user->billing_company;
|
||||
|
|
@ -236,7 +240,7 @@ class CheckoutController extends Controller
|
|||
|
||||
$data = Request::all();
|
||||
if(isset($data['payment_method'])){
|
||||
$this->isPaymentsMethodsActive($data['payment_method'], $data['is_from']);
|
||||
$this->isPaymentsMethodsActive($data['payment_method'], $data['is_from'], $data['is_abo']);
|
||||
}
|
||||
|
||||
//change selected Country
|
||||
|
|
@ -280,7 +284,15 @@ class CheckoutController extends Controller
|
|||
$shopping_user = $this->makeShoppingUser($data);
|
||||
|
||||
//make Order and Items
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user);
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user, $data);
|
||||
|
||||
//delete session
|
||||
if(\Session::has('user_shop_payment') && \Session::get('user_shop_payment') === 6){
|
||||
$user_shop_identifier = \Session::get('user_shop_identifier');
|
||||
Yard::instance('shopping')->deleteStoredCart($user_shop_identifier);
|
||||
\App\Models\ShoppingInstance::where('identifier', $user_shop_identifier)->delete();
|
||||
}
|
||||
|
||||
//CustomerPriority
|
||||
if($shopping_user->is_from === 'shopping'){
|
||||
$ret = CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
|
||||
|
|
@ -390,7 +402,6 @@ class CheckoutController extends Controller
|
|||
if(!$ShoppingPayment){
|
||||
//TODO log this
|
||||
Util::setUserHistoryValue(['status'=>21]);
|
||||
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang konnte nicht abgeschlossen werden, die Zahlung wurde nicht gefunden: '.$reference);
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
}
|
||||
|
|
@ -402,10 +413,8 @@ class CheckoutController extends Controller
|
|||
Yard::instance('shopping')->destroy();
|
||||
$this->destroy();
|
||||
|
||||
|
||||
|
||||
$payt = $ShoppingPayment->payment_transactions->last();
|
||||
|
||||
AboHelper::createNewAbo($ShoppingPayment);
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'order_reference' => $reference,
|
||||
|
|
@ -483,7 +492,22 @@ class CheckoutController extends Controller
|
|||
return $shopping_user;
|
||||
}
|
||||
|
||||
private function makeShoppingOrder($shopping_user){
|
||||
private function makeCustomerShoppingUser($shopping_data){
|
||||
// $shopping_user = ShoppingUser::findOrFail($shopping_data['shopping_user_id']);
|
||||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->fill($shopping_data);
|
||||
$shopping_user->faker_mail = false;
|
||||
|
||||
$shopping_user->auth_user_id = null;
|
||||
$shopping_user->homeparty_id = null;
|
||||
$shopping_user->same_as_billing = $shopping_user->same_as_billing ? false : true; //reinvert
|
||||
// $shopping_user->id = null;
|
||||
$shopping_user->accepted_data_checkbox = 1;
|
||||
|
||||
return $shopping_user;
|
||||
|
||||
}
|
||||
private function makeShoppingOrder($shopping_user, $data){
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
|
|
@ -496,6 +520,7 @@ class CheckoutController extends Controller
|
|||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment_for' => $shopping_user->getOrderPaymentFor(),
|
||||
'homeparty_id' => $shopping_user->homeparty_id,
|
||||
|
|
@ -520,6 +545,7 @@ class CheckoutController extends Controller
|
|||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment_for' => $shopping_user->getOrderPaymentFor(),
|
||||
'total' => $total,
|
||||
|
|
@ -540,6 +566,7 @@ class CheckoutController extends Controller
|
|||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment_for' => $shopping_user->getOrderPaymentFor(),
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ''),
|
||||
|
|
@ -551,6 +578,8 @@ class CheckoutController extends Controller
|
|||
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
|
||||
'points' => Yard::instance('shopping')->points(),
|
||||
'weight' => Yard::instance('shopping')->weight(),
|
||||
'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : false,
|
||||
'abo_interval' => isset($data['abo_interval']) ? $data['abo_interval'] : null,
|
||||
'txaction' => 'prev',
|
||||
'mode' => Util::getUserShoppingMode(),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ class ContactController extends Controller
|
|||
|
||||
$contact_mail = config('app.contact_mail');
|
||||
if($user_shop){
|
||||
Mail::to($contact['email'])->bcc([$user_shop->user->email, $contact_mail])->send(new MailContact($contact));
|
||||
Mail::to($contact['email'])->bcc([$user_shop->user->email, $contact_mail])->locale(\App::getLocale())->send(new MailContact($contact));
|
||||
}else{
|
||||
Mail::to($contact['email'])->bcc($contact_mail)->send(new MailContact($contact));
|
||||
Mail::to($contact['email'])->bcc($contact_mail)->locale(\App::getLocale())->send(new MailContact($contact));
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class HomepartyController extends Controller
|
|||
|
||||
$homeparty = Homeparty::where('token', $token)->where('token_active', true)->first();
|
||||
if(!$homeparty){
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
}
|
||||
$homeparty_user = null;
|
||||
if($gid){
|
||||
|
|
@ -45,11 +45,11 @@ class HomepartyController extends Controller
|
|||
|
||||
}else{
|
||||
//no edit
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
|
||||
$homeparty_user = HomepartyUser::find($gid);
|
||||
if(!$homeparty_user || $homeparty_user->homeparty_id !== $homeparty->id){
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ class HomepartyController extends Controller
|
|||
}
|
||||
$homeparty = Homeparty::where('token', $token)->where('token_active', true)->first();
|
||||
if(!$homeparty){
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
|
|
@ -110,15 +110,15 @@ class HomepartyController extends Controller
|
|||
]);
|
||||
}else{
|
||||
//no edit
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
$homeparty_user = HomepartyUser::find($gid);
|
||||
if(!$homeparty_user || $homeparty_user->homeparty_id !== $homeparty->id){
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
}
|
||||
}
|
||||
|
||||
if(!$homeparty_user){
|
||||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
abort(403, __('msg.link_for_homeparty_not_found'));
|
||||
}
|
||||
|
||||
$data = Request::all();
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class RegisterController extends Controller
|
|||
$user->account->data_protection = now();
|
||||
$user->account->save();
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
return redirect('/registrierung/finish');
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class SiteController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
$this->setIPInfo();
|
||||
$products = ['aloe-vera-gel-99', 'aloe-vera-saft-500-ml', 'aloe-vera-lippenbalsam'];
|
||||
// $set_products = ['aloe-vera-cleaner-set', 'aloe-vera-koerper-set', 'aloe-vera-repair-set'];
|
||||
$set_products = ['aloe-vera-koerper-set', 'baby-set', 'aloe-vera-gel-set'];
|
||||
|
|
@ -41,6 +42,9 @@ class SiteController extends Controller
|
|||
$mylangs = Shop::getLangChange();
|
||||
foreach($mylangs as $code => $country){
|
||||
if(strtolower($data['change_country_id']) === strtolower($code)){
|
||||
\Session::put('user_init_country', strtolower($code));
|
||||
\Session::forget('user_init_country_options');
|
||||
\Session::put('locale', strtolower($data['change_locale_id']));
|
||||
Shop::initUserShopLang($country);
|
||||
return back();
|
||||
}
|
||||
|
|
@ -48,8 +52,54 @@ class SiteController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
private function setIPinfo()
|
||||
{
|
||||
//wurde schon gesetzt //cache
|
||||
$country = strtolower(Shop::getIPDatabaseInfo());
|
||||
if(\Session::has('user_init_country')){
|
||||
return;
|
||||
}
|
||||
if(config('app.ipinfo')){
|
||||
$country = strtolower(Shop::getIPDatabaseInfo());
|
||||
if($country === 'de'){ //$locale de - init AT
|
||||
\Session::put('user_init_country', $country);
|
||||
return;
|
||||
}
|
||||
if($country === 'error'){ //$locale at - init AT
|
||||
$country = 'de';
|
||||
}
|
||||
}else{
|
||||
$country = 'de';
|
||||
}
|
||||
|
||||
//$locale = strtolower(\App::getLocale());
|
||||
//ist default
|
||||
|
||||
//sprache
|
||||
if(array_key_exists($country, \App\Services\UserService::getTransChange())){
|
||||
\Session::put('user_init_country', $country);
|
||||
\Session::put('locale', $country);
|
||||
\App::setLocale($country);
|
||||
}else{
|
||||
//default EN
|
||||
\Session::put('user_init_country', 'de');
|
||||
\Session::put('locale', 'de');
|
||||
\App::setLocale('de');
|
||||
}
|
||||
|
||||
//bestelland / versandland
|
||||
if(array_key_exists($country, Shop::getLangChange())){
|
||||
\Session::put('user_init_country_options', $country);
|
||||
}else{
|
||||
\Session::put('user_init_country_options', 'de');
|
||||
}
|
||||
|
||||
return redirect(route('home'));
|
||||
}
|
||||
|
||||
public function site($site, $subsite = false, $product_slug = false)
|
||||
{
|
||||
$this->setIPInfo();
|
||||
$subsite = trim($subsite, '/');
|
||||
$product_slug = trim($product_slug, '/');
|
||||
if($product_slug){
|
||||
|
|
@ -106,7 +156,7 @@ class SiteController extends Controller
|
|||
'products' => Product::where('active', true)->whereJsonContains('show_on', '1')->orderBy('pos', 'DESC')->get(),
|
||||
'product_categories' => false,
|
||||
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
|
||||
'headline' => 'Produktwelt',
|
||||
'headline' => __('website.productworld'),
|
||||
'headline_image' => false,
|
||||
];
|
||||
return view('web.templates.'.$site, $data);
|
||||
|
|
@ -126,6 +176,4 @@ class SiteController extends Controller
|
|||
}
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -14,12 +14,15 @@ use App\Models\Product;
|
|||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Services\UserService;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Mail\MailAutoReleaseAccount;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
|
||||
class WizardController extends Controller
|
||||
{
|
||||
|
|
@ -175,12 +178,18 @@ class WizardController extends Controller
|
|||
if (!Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if (!$user->account) {
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
if($step == 7 && Request::get('user_country_id')){
|
||||
$user->account->country_id = Request::get('user_country_id');
|
||||
$user->account->save();
|
||||
return redirect(route('wizard_register', [1]));
|
||||
}
|
||||
if ($step == 0) {
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required',
|
||||
|
|
@ -216,20 +225,20 @@ class WizardController extends Controller
|
|||
return redirect(route('wizard_register'));
|
||||
}
|
||||
if ($step == 1) {
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['reverse_charge_validate'])){
|
||||
$data = Request::all();
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_validate($data, $user);
|
||||
return $userRepo->reverse_charge_validate($data, $user, route('wizard_register', [0]));
|
||||
}
|
||||
|
||||
if(isset($data['reverse_charge_delete'])){
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_delete($data, $user);
|
||||
return $userRepo->reverse_charge_delete($data, $user, route('wizard_register', [0]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
|
|
@ -273,7 +282,7 @@ class WizardController extends Controller
|
|||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$validator->errors()->add('field', __('msg.no_id_card_deposited_please_upload_first'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
|
|
@ -296,7 +305,7 @@ class WizardController extends Controller
|
|||
if($data['business_license_choose'] === "now"){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
|
||||
$validator->errors()->add('field', __('msg.no_trade_licence_deposited_please_upload_first'));
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
|
|
@ -308,7 +317,7 @@ class WizardController extends Controller
|
|||
if($data['business_license_choose'] === "non"){
|
||||
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Bitte gib eine Begründung ein, warum Du keinen Gewerbeschein benötigst.'));
|
||||
$validator->errors()->add('field', __('msg.please_enter_reason_why_you_not_need_trade_licence'));
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
|
|
@ -331,7 +340,10 @@ class WizardController extends Controller
|
|||
}
|
||||
|
||||
if ($step == 4) {
|
||||
$user->wizard = 5;
|
||||
|
||||
return $this->releaseAccount($user);
|
||||
/*
|
||||
$user->wizard = 5; // muss freigeschaltet werden
|
||||
$user->release_account = now();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'release_account', 'status'=>0]);
|
||||
$user->save();
|
||||
|
|
@ -341,12 +353,56 @@ class WizardController extends Controller
|
|||
}else{
|
||||
$mail = config('app.info_mail');
|
||||
}
|
||||
Mail::to($mail)->send(new MailReleaseAccount($user));
|
||||
//Mail zur Freischaltung
|
||||
Mail::to($mail)->locale($user->getLocale())->send(new MailReleaseAccount($user));
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
//return redirect(route('wizard_register'));
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
//auto release account
|
||||
public function releaseAccount($user)
|
||||
{
|
||||
|
||||
$user->m_sponsor = $user->m_sponsor ? $user->m_sponsor : 1;
|
||||
$user->account->m_first_name = $user->account->m_first_name ? $user->account->m_first_name : $user->account->first_name;
|
||||
$user->account->m_last_name = $user->account->m_last_name ? $user->account->m_last_name : $user->account->last_name;
|
||||
$user->account->m_account = UserAccount::withTrashed()->max('m_account') +1;
|
||||
$user->account->save();
|
||||
$user->save();
|
||||
//create PDF
|
||||
$pdf = new ContractPDFRepository($user);
|
||||
$pdf->_set('disk', 'user');
|
||||
$pdf->_set('dir', '/'.$user->id.'/documents/');
|
||||
$pdf->_set('user_id', $user->id);
|
||||
$pdf->_set('identifier', 'contract');
|
||||
$pdf->createContractPDF();
|
||||
|
||||
//set wizard tp payments
|
||||
$user->wizard = 20;
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->release_account = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
//mail with code to user?
|
||||
if($user->isTestMode()){
|
||||
$mail = config('app.info_test_mail');
|
||||
}else{
|
||||
$mail = config('app.info_mail');
|
||||
}
|
||||
Mail::to($mail)->locale($user->getLocale())->send(new MailAutoReleaseAccount($user));
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'release_account', 'status'=>0]);
|
||||
Mail::to($user->email)->locale($user->getLocale())->send(new MailAccountActive($user));
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
|
||||
\Session()->flash('alert-success', __('msg.account_released'));
|
||||
return redirect(route('wizard_payment'));
|
||||
}
|
||||
|
||||
public function storeCreate($step = 0)
|
||||
{
|
||||
|
||||
|
|
@ -423,6 +479,24 @@ class WizardController extends Controller
|
|||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
if($step == 12){
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_validate($data, $user, route('wizard_create', [12]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_delete($data, $user, route('wizard_create', [12]));
|
||||
}
|
||||
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
|
|
@ -477,8 +551,8 @@ class WizardController extends Controller
|
|||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
$showAboOptions = false;
|
||||
if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$showAboOptions = false; //true Abo Option deaktivert
|
||||
$user->abo_options = false; //true Abo Option deaktivert
|
||||
$user->save();
|
||||
}
|
||||
|
||||
|
|
@ -538,6 +612,7 @@ class WizardController extends Controller
|
|||
'payment' => 4, //Berater Wizard
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
|
|
@ -563,7 +638,7 @@ class WizardController extends Controller
|
|||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
\Session()->flash('alert-success', __('msg.file_deleted'));
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,16 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
//\App\Http\Middleware\Localization::class,
|
||||
\App\Http\Middleware\Localization::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
],
|
||||
'admin' => [
|
||||
'web',
|
||||
'auth',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Closure;
|
|||
use Auth;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Uses;
|
||||
use App\Services\Util;
|
||||
use Session;
|
||||
use Yard;
|
||||
|
||||
class Checkout
|
||||
|
|
@ -23,6 +24,10 @@ class Checkout
|
|||
{
|
||||
if($shopping_instance = ShoppingInstance::where('identifier', $request->route('identifier'))->first()){
|
||||
//user shop
|
||||
|
||||
//set Lang
|
||||
\Session::put('locale', $shopping_instance->getLocale());
|
||||
\App::setLocale($shopping_instance->getLocale());
|
||||
$user_shop = $shopping_instance->user_shop;
|
||||
if($user_shop && $user_shop->active == 1 && $user_shop->user->isActiveShop()){
|
||||
Util::setPostRoute('user/');
|
||||
|
|
@ -42,15 +47,24 @@ class Checkout
|
|||
\Session::put('new_session', true);
|
||||
Yard::instance('shopping')->destroy();
|
||||
//restore yard
|
||||
if($shopping_instance->payment !== 6){
|
||||
Yard::instance('shopping')->restore($request->route('identifier'));
|
||||
|
||||
}else{
|
||||
//dont delete shopping instance
|
||||
Yard::instance('shopping')->restore($request->route('identifier'), [], false);
|
||||
}
|
||||
Yard::instance('shopping')->putYardExtra('user_shop_payment', $shopping_instance->payment);
|
||||
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $shopping_instance->shopping_data);
|
||||
$is_for = isset($shopping_instance->shopping_data['is_for']) ? $shopping_instance->shopping_data['is_for'] : 'ot';
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shopping_instance->country_id, $is_for);
|
||||
$is_for = isset($shopping_instance->shopping_data['is_for']) ? $shopping_instance->shopping_data['is_for'] : 'ot-member';
|
||||
Yard::instance('shopping')->setUserPriceInfos($shopping_instance->shopping_data['user_price_infos']);
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shopping_instance->country_id, $is_for);
|
||||
|
||||
if($shopping_instance->payment !== 6){
|
||||
//delete shopping instance
|
||||
ShoppingInstance::where('identifier', $request->route('identifier'))->delete();
|
||||
}
|
||||
|
||||
$request->route()->forgetParameter('identifier');
|
||||
|
||||
return $next($request);
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ class Localization
|
|||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
if ( \Session::has('locale')) {
|
||||
if (\Session::has('locale')) {
|
||||
\App::setLocale(\Session::get('locale'));
|
||||
Carbon::setLocale(\Session::get('locale'));
|
||||
// Carbon::setLocale('\Session::get('locale')');
|
||||
//Carbon::setLocale('de');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
|||
41
app/Libraries/CreditDetailsPDF.php
Normal file
41
app/Libraries/CreditDetailsPDF.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
namespace App\Libraries;
|
||||
|
||||
|
||||
class CreditDetailsPDF{
|
||||
|
||||
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
|
||||
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->getDomPDF()->set_option("enable_php", true);
|
||||
$pdf->loadView($this->view, $data);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -22,7 +22,8 @@ class InvoicePDF{
|
|||
//dd($data);
|
||||
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->getDomPDF()->set_option("enable_php", true);
|
||||
$pdf->getDomPDF();
|
||||
$pdf->set_option("enable_php", true);
|
||||
$pdf->loadView($this->view, $data);
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
|
|
|
|||
188
app/Libraries/MyPDFMerger.php
Normal file
188
app/Libraries/MyPDFMerger.php
Normal 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.
|
||||
*/
|
||||
38
app/Mail/Exception.php
Normal file
38
app/Mail/Exception.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
class Exception extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $content;
|
||||
public $css;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
public function __construct($css, $content)
|
||||
{
|
||||
$this->css = $css;
|
||||
$this->content = $content;
|
||||
|
||||
}
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('emails.exception')
|
||||
->subject('mivita Exception Logged!')
|
||||
->with([
|
||||
'content' => $this->content,
|
||||
'css' => $this->css,
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
36
app/Mail/ExceptionOccured.php
Normal file
36
app/Mail/ExceptionOccured.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ExceptionOccured extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $content;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('emails.exception')
|
||||
->with('content', $this->content);
|
||||
}
|
||||
}
|
||||
62
app/Mail/MailAutoReleaseAccount.php
Normal file
62
app/Mail/MailAutoReleaseAccount.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailAutoReleaseAccount extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->subject = 'Neuer Berater Registrierung und freigeschaltet';
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$content = __(strtoupper($this->user->account->salutation))." ";
|
||||
$content .= $this->user->account->first_name." ".$this->user->account->last_name."\n";
|
||||
$content .= $this->user->account->address."\n";
|
||||
$content .= $this->user->account->zipcode." ".$this->user->account->city."\n";
|
||||
$content .= $this->user->account->country_id ? $this->user->account->country->de."\n\n" : "\n\n";
|
||||
if($this->user->account->phone){
|
||||
$content .= "Telefon: ";
|
||||
$content .= $this->user->account->pre_phone_id ? $this->user->account->pre_phone->phone." " : " ";
|
||||
$content .= $this->user->account->phone;
|
||||
}
|
||||
if($this->user->account->mobil){
|
||||
$content .= "Mobil: ";
|
||||
$content .= $this->user->account->pre_mobil_id ? $this->user->account->pre_mobil->phone." " : " ";
|
||||
$content .= $this->user->account->mobil;
|
||||
}
|
||||
$content .= "E-Mail: ".$this->user->email;
|
||||
|
||||
|
||||
$copy1line = "Ein neuer Berater hat sich registriert und wurde automatisch freigeschaltet. Seine Daten müssen nachträglich Überprüfung werden:"."\n";
|
||||
$copy1line .= "+ Überprüfung der Ausweisdaten"."\n";
|
||||
$copy1line .= "+ Überprüfung des Gewerbenachweises"."\n";
|
||||
$copy1line .= "+ Eintrag Account ID"."\n";
|
||||
$copy1line .= "+ Überprüfung / Kenntnisnahme Sponsor"."\n";
|
||||
$copy1line .= "+ Überprüfung der Rechnungsdaten"."\n";
|
||||
$copy1line .= 'Sollte Daten nicht vollständig sein, bitte Kontakt zum Berater aufnehmen.'."\n";
|
||||
|
||||
return $this->view('emails.info')->with([
|
||||
'url' => route('admin_lead_edit', $this->user->id).'?show=check_lead',
|
||||
'title' => 'Berater Registrierung prüfen',
|
||||
'button' => 'zur Berater Prüfung',
|
||||
'copy1line' => $copy1line,
|
||||
'copy2line' => __('email.copy2line'),
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ class MailCredit extends Mailable
|
|||
public function __construct(UserCredit $user_credit)
|
||||
{
|
||||
$this->user_credit = $user_credit;
|
||||
$this->subject = 'Deine Gutschrift auf mivita.care';
|
||||
$this->subject = __('email.credit_title');
|
||||
}
|
||||
|
||||
public function build()
|
||||
|
|
|
|||
57
app/Mail/MailCustomPaymet.php
Normal file
57
app/Mail/MailCustomPaymet.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Services\Util;
|
||||
|
||||
class MailCustomPaymet extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $route;
|
||||
protected $shopping_user;
|
||||
protected $shopping_instance;
|
||||
protected $mode;
|
||||
protected $name;
|
||||
protected $yard_shopping_items;
|
||||
|
||||
|
||||
public $subject;
|
||||
public $data;
|
||||
|
||||
|
||||
public function __construct($route, $shopping_user, $shopping_instance, $yard_shopping_items, $mode)
|
||||
{
|
||||
$this->route = $route;
|
||||
$this->shopping_user = $shopping_user;
|
||||
$this->shopping_instance = $shopping_instance;
|
||||
$this->mode = $mode;
|
||||
$this->yard_shopping_items = $yard_shopping_items;
|
||||
|
||||
$this->name = $shopping_user->member->account->first_name." ".$shopping_user->member->account->last_name." - ";
|
||||
$this->subject = __('email.subject_custom_payout', ['name' => $this->name]);
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$salutation = __('email.hello')." ".$this->shopping_user->billing_firstname.",";
|
||||
|
||||
return $this->view('emails.custom_payment')->with([
|
||||
'salutation' => $salutation,
|
||||
'copy1line' => __('email.your_custom_payout', ['name' => $this->name]),
|
||||
'shopping_user' => $this->shopping_user,
|
||||
'shopping_instance' => $this->shopping_instance,
|
||||
'yard_shopping_items' => $this->yard_shopping_items,
|
||||
'copy3line' => __('email.checkout_copy3line'),
|
||||
'greetings' => __('email.greetings'),
|
||||
'route' => $this->route,
|
||||
'mode' => $this->mode,
|
||||
'sender' => __('email.sender'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,7 @@ class MailInvoice extends Mailable
|
|||
{
|
||||
$this->shopping_order = $shopping_order;
|
||||
$this->user_invoice = $user_invoice;
|
||||
$this->subject = 'Rechnung zu Deiner Bestellung: '.$shopping_order->getLastShoppingPayment('reference') ;
|
||||
|
||||
$this->subject = __('email.invoice_subject').': '.$shopping_order->getLastShoppingPayment('reference') ;
|
||||
}
|
||||
|
||||
public function build()
|
||||
|
|
|
|||
63
app/Mail/MailLog.php
Normal file
63
app/Mail/MailLog.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailLog extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $channel;
|
||||
protected $context;
|
||||
protected $message;
|
||||
protected $data;
|
||||
|
||||
public $subject;
|
||||
|
||||
public function __construct($channel, $context, $message, $data)
|
||||
{
|
||||
$this->channel = $channel;
|
||||
$this->context = $context;
|
||||
$this->message = $message;
|
||||
$this->data = $data;
|
||||
$this->subject = 'mivita Log';
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$title = 'Log: '.$this->channel.' '.$this->context;
|
||||
|
||||
//make Data readable
|
||||
$this->data = json_encode($this->data, JSON_PRETTY_PRINT);
|
||||
$content = "";
|
||||
|
||||
|
||||
$content .= "\n";
|
||||
$content .= "Channel: ".$this->channel."\n";
|
||||
$content .= "Context: ".$this->context."\n";
|
||||
if(\Auth::check()){
|
||||
$content .= "From User: ".\Auth::user()->id." | ".\Auth::user()->email."\n";
|
||||
}
|
||||
$content .= "\n";
|
||||
$content .= "Message: ".$this->message."\n";
|
||||
$content .= "\n";
|
||||
$content .= "Data: ".$this->data."\n";
|
||||
$content .= "\n";
|
||||
$content .= "\n";
|
||||
$content .= "Time: ".now()->format("d.m.Y H:i");
|
||||
$content .= "\n";
|
||||
$content .= request()->header('User-Agent');
|
||||
|
||||
|
||||
return $this->view('emails.sys')->with([
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ class MailReleaseAccount extends Mailable
|
|||
|
||||
|
||||
$copy1line = "Ein neuer Berater hat sich registriert und wartet auf die Überprüfung und Freigabe seiner Daten:"."\n";
|
||||
$copy1line .= "+ Überprüfung der Ausweisdate"."\n";
|
||||
$copy1line .= "+ Überprüfung der Ausweisdaten"."\n";
|
||||
$copy1line .= "+ Überprüfung des Gewerbenachweises"."\n";
|
||||
$copy1line .= "+ Eintrag Account ID"."\n";
|
||||
$copy1line .= "+ Überprüfung / Kenntnisnahme Sponsor"."\n";
|
||||
|
|
|
|||
59
app/Mail/MailReleaseDocument.php
Normal file
59
app/Mail/MailReleaseDocument.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailReleaseDocument extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $user;
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->subject = 'Berater Unterlagen prüfen';
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
$content = __(strtoupper($this->user->account->salutation))." ";
|
||||
$content .= $this->user->account->first_name." ".$this->user->account->last_name."\n";
|
||||
$content .= $this->user->account->address."\n";
|
||||
$content .= $this->user->account->zipcode." ".$this->user->account->city."\n";
|
||||
$content .= $this->user->account->country_id ? $this->user->account->country->de."\n\n" : "\n\n";
|
||||
$content .= "E-Mail: ".$this->user->email;
|
||||
|
||||
|
||||
$copy1line = "Ein Berater hat Daten zum Gewerbenachweis geändert, bitte um Prüfung:"."\n\n";
|
||||
|
||||
$business_license_choose = $this->user->account->getNotice('business_license');
|
||||
if($business_license_choose === 'now'){
|
||||
$copy1line .= "+ Gewerbeschein jetzt zur Freigabe"."\n\n";
|
||||
}
|
||||
if($business_license_choose === 'later'){
|
||||
$copy1line .= "+ Ich reiche meinen Gewerbeschein innerhalb der nächsten 4 Wochen nach"."\n\n";
|
||||
}
|
||||
if($business_license_choose === 'non'){
|
||||
$copy1line .= "+ Ich benötige keinen Gewerbeschein"."\n";
|
||||
$copy1line .= "+ Begründung: ".$this->user->account->getNotice('business_license_reason')."\n\n";
|
||||
}
|
||||
|
||||
$copy1line .= 'Bei fehlerhafter Angabe nimm bitte kontakt mit dem Berater auf.'."\n";
|
||||
|
||||
return $this->view('emails.info')->with([
|
||||
'url' => route('admin_lead_edit', $this->user->id).'?show=check_lead',
|
||||
'title' => 'Berater Unterlagen prüfen',
|
||||
'button' => 'zur Berater Prüfung',
|
||||
'copy1line' => $copy1line,
|
||||
'copy2line' => __('email.copy2line'),
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ class MailUserLevelUpdate extends Mailable
|
|||
$this->team_points = $team_points;
|
||||
$this->update_to = $update_to;
|
||||
|
||||
$this->subject = 'Deine Karriere-Level auf mivita.care';
|
||||
$this->subject = __('email.update_level_title');
|
||||
}
|
||||
|
||||
public function build()
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ use Cviebrock\EloquentSluggable\Sluggable;
|
|||
* @property-read \App\Models\IqImage|null $iq_image
|
||||
* @property-read int|null $product_categories_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Category withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\TransCategory> $translations
|
||||
* @property-read int|null $translations_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Category extends Model
|
||||
|
|
@ -53,7 +55,6 @@ class Category extends Model
|
|||
|
||||
protected $table = 'categories';
|
||||
|
||||
protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array'];
|
||||
|
||||
protected $fillable = [
|
||||
'parent_id', 'name', 'headline', 'pos', 'active',
|
||||
|
|
@ -84,6 +85,27 @@ class Category extends Model
|
|||
|
||||
}
|
||||
|
||||
public function productCategoriesCountActive()
|
||||
{
|
||||
$category_id = $this->id;
|
||||
return Product::where('active', true)->whereHas('product_categories', function ($query) use ($category_id) {
|
||||
$query->where('category_id', $category_id); //
|
||||
})->orderBy('pos', 'ASC')->count();
|
||||
}
|
||||
|
||||
public function productCategoriesCountActiveOn($show_on = ['1'])
|
||||
{
|
||||
$category_id = $this->id;
|
||||
return Product::where('active', true)->whereJsonContains('show_on', $show_on)
|
||||
->whereHas('product_categories', function ($query) use ($category_id) {
|
||||
$query->where('category_id', $category_id); //
|
||||
})->orderBy('pos', 'ASC')->count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function iq_image()
|
||||
{
|
||||
return $this->belongsTo('App\Models\IqImage', 'headline_image_id');
|
||||
|
|
@ -93,44 +115,29 @@ class Category extends Model
|
|||
$this->attributes['pos'] = is_numeric($value) ? $value : null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(TransCategory::class, 'categorie_id');
|
||||
}
|
||||
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang === 'de') {
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
$trans = $this->getTrans($key, $lang);
|
||||
if (!$trans || $trans == '') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $trans;
|
||||
return $trans != '' ? $trans : $this->{$key};
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$key = 'trans_' . $key;
|
||||
if (!empty($this->{$key}[$lang])) {
|
||||
return $this->{$key}[$lang];
|
||||
}
|
||||
return "";
|
||||
$trans = $this->translations->where('language','=', $lang)->where('key', $key)->first();
|
||||
return $trans ? $trans->value : '';
|
||||
}
|
||||
|
||||
public function getTranNames()
|
||||
{
|
||||
$ret = "";
|
||||
foreach ((array) $this->trans_name as $value){
|
||||
$ret .= $value.', ';
|
||||
}
|
||||
return rtrim($ret, ', ');
|
||||
}
|
||||
|
||||
public function getTranHeadlines()
|
||||
{
|
||||
$ret = "";
|
||||
foreach ((array) $this->trans_headline as $value){
|
||||
$ret .= $value.', ';
|
||||
}
|
||||
return rtrim($ret, ', ');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,8 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTrans($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereUpdatedAt($value)
|
||||
* @property string|null $trans_name
|
||||
* @property array|null $attr
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereAttr($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTransName($value)
|
||||
* @property bool|null $switch
|
||||
* @property bool|null $own_eur
|
||||
* @property bool|null $currency
|
||||
|
|
@ -60,6 +58,8 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @property bool|null $supply_country
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereEuCountry($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereSupplyCountry($value)
|
||||
* @property bool|null $translate
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereTranslate($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Country extends Model
|
||||
|
|
@ -68,19 +68,19 @@ class Country extends Model
|
|||
|
||||
protected $casts = [
|
||||
'switch' => 'bool',
|
||||
'translate' => 'bool',
|
||||
'supply_country' => 'bool',
|
||||
'eu_country' => 'bool',
|
||||
'own_eur' => 'bool',
|
||||
'currency' => 'bool',
|
||||
'currency_calc' => 'bool',
|
||||
'trans_name' => 'array',
|
||||
'attr' => 'array'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru',
|
||||
'supply_country', 'eu_country', 'switch', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
|
||||
'active', 'trans_name', 'attr',
|
||||
'supply_country', 'eu_country', 'switch', 'translate', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
|
||||
'active', 'attr',
|
||||
];
|
||||
|
||||
public function country_prices()
|
||||
|
|
@ -92,7 +92,6 @@ class Country extends Model
|
|||
|
||||
if(!$lang){
|
||||
$lang = \App::getLocale();
|
||||
|
||||
}
|
||||
if($lang === 'de'){
|
||||
return $this->de;
|
||||
|
|
@ -114,21 +113,9 @@ class Country extends Model
|
|||
}
|
||||
|
||||
//search by trans
|
||||
|
||||
if($val = $this->getTrans('name', $lang)){
|
||||
return $val;
|
||||
}
|
||||
return $this->de;
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$key = 'trans_' . $key;
|
||||
if (!empty($this->{$key}[$lang])) {
|
||||
return $this->{$key}[$lang];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getAttrByKey($key)
|
||||
{
|
||||
|
|
|
|||
33
app/Models/DbipLookup.php
Normal file
33
app/Models/DbipLookup.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DbipLookup
|
||||
*
|
||||
* @property string $addr_type
|
||||
* @property string $ip_start
|
||||
* @property string $ip_end
|
||||
* @property string $country
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DbipLookup extends Model
|
||||
{
|
||||
protected $table = 'dbip_lookup';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'addr_type',
|
||||
'ip_start',
|
||||
'ip_end',
|
||||
'country'
|
||||
];
|
||||
}
|
||||
33
app/Models/DbipLookup2.php
Normal file
33
app/Models/DbipLookup2.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DbipLookup
|
||||
*
|
||||
* @property string $addr_type
|
||||
* @property string $ip_start
|
||||
* @property string $ip_end
|
||||
* @property string $country
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DbipLookup2 extends Model
|
||||
{
|
||||
protected $table = 'dbip_lookup_2';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'addr_type',
|
||||
'ip_start',
|
||||
'ip_end',
|
||||
'country'
|
||||
];
|
||||
}
|
||||
33
app/Models/DbipLookup3.php
Normal file
33
app/Models/DbipLookup3.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DbipLookup
|
||||
*
|
||||
* @property string $addr_type
|
||||
* @property string $ip_start
|
||||
* @property string $ip_end
|
||||
* @property string $country
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DbipLookup3 extends Model
|
||||
{
|
||||
protected $table = 'dbip_lookup_3';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'addr_type',
|
||||
'ip_start',
|
||||
'ip_end',
|
||||
'country'
|
||||
];
|
||||
}
|
||||
52
app/Models/DcCategory.php
Normal file
52
app/Models/DcCategory.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
|
||||
|
||||
/**
|
||||
* Class DcCategory
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property int $pos
|
||||
* @property string $slug
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DcCategory extends Model
|
||||
{
|
||||
use Sluggable;
|
||||
|
||||
protected $table = 'dc_categories';
|
||||
|
||||
protected $casts = [
|
||||
'pos' => 'int',
|
||||
'active' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'pos',
|
||||
'slug',
|
||||
'active'
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
190
app/Models/DcFile.php
Normal file
190
app/Models/DcFile.php
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DcFile
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $filename
|
||||
* @property string $original_name
|
||||
* @property string $ext
|
||||
* @property string $mine
|
||||
* @property int|null $size
|
||||
* @property int|null $active
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Collection|DcFileTag[] $dc_file_tags
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DcFile extends Model
|
||||
{
|
||||
protected $table = 'dc_files';
|
||||
|
||||
protected $casts = [
|
||||
'size' => 'int',
|
||||
'active' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'filename',
|
||||
'original_name',
|
||||
'ext',
|
||||
'mine',
|
||||
'size',
|
||||
'active'
|
||||
];
|
||||
|
||||
public function dc_file_tags()
|
||||
{
|
||||
return $this->hasMany(DcFileTag::class, 'file_id');
|
||||
}
|
||||
|
||||
public function tags(){
|
||||
return $this->belongsToMany(DcTag::class, 'dc_file_tags', 'file_id', 'tag_id');
|
||||
}
|
||||
|
||||
public function fileTag(){
|
||||
return $this->hasMany(DcFileTag::class, 'file_id');
|
||||
}
|
||||
|
||||
public function hasTags()
|
||||
{
|
||||
if($this->fileTag()->count()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//path /storage/app/dc/ ...
|
||||
/*public function isImage(){
|
||||
if(empty($this->attributes['filename']) || @$this->attributes['filename'] == null || @$this->attributes['filename'] == ""){
|
||||
return false;
|
||||
}
|
||||
if(!\Storage::disk('public')->has('images/shop/'.$this->filename)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getImage(){
|
||||
if($this->isImage()){
|
||||
$link = 'images/shop/'.$this->filename;
|
||||
return '/storage/'.$link.'?=lm='.\Storage::disk('public')->lastModified($link);
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
|
||||
public function hasThumb(){
|
||||
if(\Storage::disk('public')->exists('dc/thumb/'.$this->filename) || \Storage::disk('public')->exists('dc/thumb/'.$this->filename.".jpg")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasBig(){
|
||||
if(\Storage::disk('public')->exists('dc/big/'.$this->filename) || \Storage::disk('public')->exists('dc/big/'.$this->filename.".jpg")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public function hasFile(){
|
||||
if(\Storage::disk('public')->exists('dc/files/'.$this->filename) || \Storage::disk('public')->exists('dc/files/'.$this->filename.".jpg")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getThumb($full = false){
|
||||
$link = 'dc/thumb/'.$this->filename;
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
$link.=".jpg";
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getBig($full = false){
|
||||
$link = 'dc/big/'.$this->filename;
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
$link.=".jpg";
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getFile($full = false){
|
||||
$link = 'dc/files/'.$this->filename;
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
$link.=".jpg";
|
||||
if(\Storage::disk('public')->exists($link)){
|
||||
return $full ? \Storage::disk('public')->path($link) : $link;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getLastModified($type = 'thumb'){
|
||||
if($type == 'thumb'){
|
||||
$link = $this->getThumb();
|
||||
}
|
||||
if($type == 'big'){
|
||||
$link = $this->getBig();
|
||||
}
|
||||
if($type == 'file'){
|
||||
$link = $this->getFile();
|
||||
}
|
||||
return \Storage::disk('public')->lastModified($link);
|
||||
}
|
||||
|
||||
|
||||
public function getTags(){
|
||||
$tags = $this->tags;
|
||||
$tagArray = [];
|
||||
foreach($tags as $tag){
|
||||
$tagArray[] = $tag->name;
|
||||
}
|
||||
return implode(', ', $tagArray);
|
||||
}
|
||||
public function thumb(){
|
||||
$ext = $this->ext;
|
||||
$ext = strtolower($ext);
|
||||
if($ext == 'pdf'){
|
||||
return 'pdf.png';
|
||||
}
|
||||
if($ext == 'doc' || $ext == 'docx'){
|
||||
return 'doc.png';
|
||||
}
|
||||
if($ext == 'xls' || $ext == 'xlsx'){
|
||||
return 'xls.png';
|
||||
}
|
||||
if($ext == 'ppt' || $ext == 'pptx'){
|
||||
return 'ppt.png';
|
||||
}
|
||||
if($ext == 'zip' || $ext == 'rar'){
|
||||
return 'zip.png';
|
||||
}
|
||||
if($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif'){
|
||||
return $this->filename;
|
||||
}
|
||||
return 'file.png';
|
||||
}
|
||||
}
|
||||
49
app/Models/DcFileTag.php
Normal file
49
app/Models/DcFileTag.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DcFileTag
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $file_id
|
||||
* @property int $tag_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property DcFile $dc_file
|
||||
* @property DcTag $dc_tag
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DcFileTag extends Model
|
||||
{
|
||||
protected $table = 'dc_file_tags';
|
||||
|
||||
protected $casts = [
|
||||
'file_id' => 'int',
|
||||
'tag_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'file_id',
|
||||
'tag_id'
|
||||
];
|
||||
|
||||
public function dc_file()
|
||||
{
|
||||
return $this->belongsTo(DcFile::class, 'file_id');
|
||||
}
|
||||
|
||||
public function dc_tag()
|
||||
{
|
||||
return $this->belongsTo(DcTag::class, 'tag_id');
|
||||
}
|
||||
}
|
||||
63
app/Models/DcTag.php
Normal file
63
app/Models/DcTag.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
|
||||
|
||||
/**
|
||||
* Class DcTag
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $category_id
|
||||
* @property string $name
|
||||
* @property int $pos
|
||||
* @property string $slug
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Collection|DcFileTag[] $dc_file_tags
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class DcTag extends Model
|
||||
{
|
||||
use Sluggable;
|
||||
|
||||
protected $table = 'dc_tags';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'pos' => 'int',
|
||||
'active' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'name',
|
||||
'pos',
|
||||
'slug',
|
||||
'active'
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function dc_file_tags()
|
||||
{
|
||||
return $this->hasMany(DcFileTag::class, 'tag_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +90,7 @@ class Homeparty extends Model
|
|||
'settings' => 'array',
|
||||
'order' => 'array',
|
||||
'card_info' => 'array',
|
||||
'trans_description' => 'array',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
|
@ -106,7 +107,6 @@ class Homeparty extends Model
|
|||
'name',
|
||||
'place',
|
||||
'country_id',
|
||||
'description',
|
||||
'pos',
|
||||
'completed',
|
||||
'status',
|
||||
|
|
@ -152,6 +152,39 @@ class Homeparty extends Model
|
|||
}
|
||||
|
||||
|
||||
public function getLang($key, $default = true)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $this->getTrans($key, $lang, $default);
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang, $default = true)
|
||||
{
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
if($key === 'description' && !empty($this->trans_description[$lang])){
|
||||
return $this->trans_description[$lang];
|
||||
}
|
||||
if($default){
|
||||
return !empty($this->{$key}) ? $this->{$key} : '';
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getLangOrDefault($key, $default = true)
|
||||
{
|
||||
$dkey = 'default_'.$key;
|
||||
$value = $this->getLang($key, $default);
|
||||
if(!$value || $value == ""){
|
||||
return __('homeparty.welcome_copy');
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getDateAttribute($value)
|
||||
{
|
||||
if (!$value) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereTransInci($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereUpdatedAt($value)
|
||||
* @property-read Collection<int, \App\Models\TransIngredient> $translations
|
||||
* @property-read int|null $translations_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Ingredient extends Model
|
||||
|
|
@ -56,11 +58,8 @@ class Ingredient extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'trans_name',
|
||||
'inci',
|
||||
'trans_inci',
|
||||
'effect',
|
||||
'trans_effect',
|
||||
'active',
|
||||
'pos'
|
||||
];
|
||||
|
|
@ -77,4 +76,26 @@ class Ingredient extends Model
|
|||
return $this->hasMany(ProductIngredient::class, 'product_ingredients', 'id');
|
||||
|
||||
}
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(TransIngredient::class, 'ingredient_id');
|
||||
}
|
||||
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
$trans = $this->getTrans($key, $lang);
|
||||
return $trans != '' ? $trans : $this->{$key};
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$trans = $this->translations->where('language','=', $lang)->where('key', $key)->first();
|
||||
return $trans ? $trans->value : '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,223 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class UserInvoiceCredit
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $auth_user_id
|
||||
* @property int|null $shopping_order_id
|
||||
* @property int|null $shopping_user_id
|
||||
* @property string $type
|
||||
* @property string|null $full_number
|
||||
* @property int|null $number
|
||||
* @property float|null $net
|
||||
* @property float|null $tax_rate
|
||||
* @property float|null $tax
|
||||
* @property float|null $total
|
||||
* @property string|null $file
|
||||
* @property string|null $contents
|
||||
* @property string|null $infos
|
||||
* @property string|null $subject
|
||||
* @property string|null $address
|
||||
* @property bool $paid
|
||||
* @property Carbon|null $paid_date
|
||||
* @property int|null $cancellation_id
|
||||
* @property Carbon|null $cancellation_date
|
||||
* @property int $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $deleted_at
|
||||
* @property User|null $user
|
||||
* @property UserInvoiceCredit|null $user_invoice_credit
|
||||
* @property ShoppingOrder|null $shopping_order
|
||||
* @property ShoppingUser|null $shopping_user
|
||||
* @property Collection|UserInvoiceCredit[] $user_invoice_credits
|
||||
* @package App\Models
|
||||
* @property-read int|null $user_invoice_credits_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAuthUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereContents($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFile($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFullNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereInfos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaid($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaidDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereSubject($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserInvoiceCredit extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'user_invoice_credits';
|
||||
|
||||
protected $casts = [
|
||||
'auth_user_id' => 'int',
|
||||
'shopping_order_id' => 'int',
|
||||
'shopping_user_id' => 'int',
|
||||
'number' => 'int',
|
||||
'year' => 'int',
|
||||
'month' => 'int',
|
||||
'net' => 'float',
|
||||
'tax_rate' => 'float',
|
||||
'tax' => 'float',
|
||||
'total' => 'float',
|
||||
'paid' => 'bool',
|
||||
'cancellation_id' => 'int',
|
||||
'status' => 'int',
|
||||
'file' => 'array',
|
||||
'contents' => 'array',
|
||||
'infos' => 'array',
|
||||
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'paid_date',
|
||||
'cancellation_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'auth_user_id',
|
||||
'shopping_order_id',
|
||||
'shopping_user_id',
|
||||
'type',
|
||||
'year',
|
||||
'month',
|
||||
'full_number',
|
||||
'number',
|
||||
'net',
|
||||
'tax_rate',
|
||||
'tax',
|
||||
'total',
|
||||
'file',
|
||||
'contents',
|
||||
'infos',
|
||||
'subject',
|
||||
'address',
|
||||
'paid',
|
||||
'paid_date',
|
||||
'cancellation_id',
|
||||
'cancellation_date',
|
||||
'status'
|
||||
];
|
||||
|
||||
public static $monthNames = [
|
||||
1 => 'Januar',
|
||||
2 => 'Februar',
|
||||
3 => 'März',
|
||||
4 => 'April',
|
||||
5 => 'Mai',
|
||||
6 => 'Juni',
|
||||
7 => 'Juli',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'Oktober',
|
||||
11 => 'November',
|
||||
12 => 'Dezember'
|
||||
];
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'bezahlt',
|
||||
2 => 'prüfen',
|
||||
10 => 'storniert'
|
||||
];
|
||||
|
||||
public static $statusColors = [
|
||||
0 => 'warning',
|
||||
1 => 'success',
|
||||
2 => 'secondary',
|
||||
10 => 'danger',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class, 'auth_user_id');
|
||||
}
|
||||
|
||||
public function user_invoice_credit()
|
||||
{
|
||||
return $this->belongsTo(UserInvoiceCredit::class, 'cancellation_id');
|
||||
}
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo(ShoppingOrder::class);
|
||||
}
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo(ShoppingUser::class);
|
||||
}
|
||||
|
||||
public function user_invoice_credits()
|
||||
{
|
||||
return $this->hasMany(UserInvoiceCredit::class, 'cancellation_id');
|
||||
}
|
||||
|
||||
public function getPaidDateAttribute($value){
|
||||
return $this->attributes['paid_date'] ? Carbon::parse($this->attributes['paid_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
public function setPaidDateAttribute( $value ) {
|
||||
$this->attributes['paid_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getPaidDateRaw(){
|
||||
return isset($this->attributes['paid_date']) ? $this->attributes['paid_date'] : NULL;
|
||||
}
|
||||
|
||||
public function getCancellationDateAttribute($value){
|
||||
return $this->attributes['cancellation_date'] ? Carbon::parse($this->attributes['cancellation_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
public function setCancellationDateAttribute( $value ) {
|
||||
$this->attributes['cancellation_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getCancellationDateRaw(){
|
||||
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
|
||||
}
|
||||
|
||||
|
||||
public static function getMonthName($month)
|
||||
{
|
||||
return isset(self::$monthNames[$month]) ? self::$monthNames[$month] : $month;
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
|
||||
}
|
||||
|
||||
public function getStatusColor(){
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,6 +48,7 @@ class PaymentMethod extends Model
|
|||
'pos' => 'int',
|
||||
'active' => 'bool',
|
||||
'default' => 'bool',
|
||||
'is_abo' => 'bool',
|
||||
'show_on' => 'array',
|
||||
];
|
||||
|
||||
|
|
@ -58,6 +59,7 @@ class PaymentMethod extends Model
|
|||
'show_on',
|
||||
'pos',
|
||||
'default',
|
||||
'is_abo',
|
||||
'active'
|
||||
];
|
||||
|
||||
|
|
@ -95,7 +97,10 @@ class PaymentMethod extends Model
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getDefaultAsArray($short=false){
|
||||
public static function getDefaultAsArray($is_abo=false){
|
||||
if($is_abo){
|
||||
return PaymentMethod::where('active', true)->where('default', true)->where('is_abo', $is_abo)->pluck('id');
|
||||
}
|
||||
return PaymentMethod::where('active', true)->where('default', true)->pluck('id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductBuying> $product_buyings
|
||||
* @property-read int|null $product_buyings_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductBuying> $product_buyings
|
||||
* @property bool|null $sponsor_buying_points
|
||||
* @property int|null $sponsor_buying_points_amount
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductBuying> $product_buyings
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereSponsorBuyingPoints($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereSponsorBuyingPointsAmount($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductBuying> $product_buyings
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\TransProduct> $translations
|
||||
* @property-read int|null $translations_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductCategory> $product_categories
|
||||
* @property-read int|null $product_categories_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Product extends Model
|
||||
|
|
@ -215,8 +225,8 @@ class Product extends Model
|
|||
0 => '',
|
||||
1 => 'ml',
|
||||
2 => 'g',
|
||||
3 => 'Liter',
|
||||
4 => 'KG',
|
||||
3 => 'liter',
|
||||
4 => 'kg',
|
||||
];
|
||||
|
||||
public $showATs = [
|
||||
|
|
@ -239,6 +249,9 @@ class Product extends Model
|
|||
8 => 'Mitgliedschaft Berater',
|
||||
9 => 'Onboarding Berater',
|
||||
10 => 'zur internen Berechnung',
|
||||
12 => 'Abo-ShopBerater',
|
||||
13 => 'Abo-ShopBeraterKunden',
|
||||
|
||||
];
|
||||
|
||||
public $actions = [
|
||||
|
|
@ -278,6 +291,10 @@ class Product extends Model
|
|||
return $this->hasMany('App\Models\ProductCategory', 'product_id', 'id')->orderBy('pos', 'DESC');
|
||||
}
|
||||
|
||||
public function product_categories(){
|
||||
return $this->hasMany('App\Models\ProductCategory', 'product_id', 'id')->orderBy('pos', 'DESC');
|
||||
}
|
||||
|
||||
public function images(){
|
||||
return $this->hasMany('App\Models\ProductImage', 'product_id', 'id')->orderBy('pos');
|
||||
}
|
||||
|
|
@ -302,6 +319,10 @@ class Product extends Model
|
|||
return $this->hasMany(CountryPrice::class, 'product_id');
|
||||
}
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(TransProduct::class, 'product_id');
|
||||
}
|
||||
|
||||
public function p_ingredients()
|
||||
{
|
||||
|
|
@ -382,6 +403,19 @@ class Product extends Model
|
|||
}
|
||||
return $price;
|
||||
}
|
||||
|
||||
private function calcPriceUserCommission($price){
|
||||
if($this->no_commission){
|
||||
return $price;
|
||||
}
|
||||
if(\Auth::user() && \Auth::user()->user_level){
|
||||
$margin = \Auth::user()->user_level->margin;
|
||||
$price = $price / 100 * $margin;
|
||||
}
|
||||
return $price;
|
||||
}
|
||||
|
||||
|
||||
/*price net*/
|
||||
private function calcPriceNet($price, $country=null){
|
||||
$tax = $this->getTaxWith($country);
|
||||
|
|
@ -389,18 +423,21 @@ class Product extends Model
|
|||
return $price / $tax_rate;
|
||||
}
|
||||
//price calu with
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null){
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false){
|
||||
$price = isset($this->attributes['price']) ? $this->attributes['price'] : null;
|
||||
$cprice = $country ? $this->getCPrice($country) : null;
|
||||
$price = $cprice ? $cprice : $price;
|
||||
$price = $net ? $this->calcPriceNet($price, $country) : $price;
|
||||
$price = $ufactor ? $this->calcPriceUserFactor($price) : $price;
|
||||
$price = $commission ? $this->calcPriceUserCommission($price) : $price;
|
||||
|
||||
return round($price, 2);
|
||||
}
|
||||
|
||||
/*out*/
|
||||
public function getFormattedPriceWith(Bool $net = true, Bool $ufactor = true, $country = null)
|
||||
public function getFormattedPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false)
|
||||
{
|
||||
return isset($this->attributes['price']) ? Util::formatNumber($this->getPriceWith($net, $ufactor, $country)) : "";
|
||||
return isset($this->attributes['price']) ? Util::formatNumber($this->getPriceWith($net, $ufactor, $country, $commission)) : "";
|
||||
}
|
||||
|
||||
public function getTaxWith($country = null){
|
||||
|
|
@ -496,7 +533,7 @@ class Product extends Model
|
|||
|
||||
|
||||
public function getUnitType(){
|
||||
return isset($this->unitTypes[$this->unit]) ? $this->unitTypes[$this->unit] : '-';
|
||||
return isset($this->unitTypes[$this->unit]) ? __($this->unitTypes[$this->unit]) : '-';
|
||||
}
|
||||
public function getShowAtType(){
|
||||
return isset($this->showATs[$this->show_at]) ? $this->showATs[$this->show_at] : '-';
|
||||
|
|
@ -523,18 +560,13 @@ class Product extends Model
|
|||
return $this->{$key};
|
||||
}
|
||||
$trans = $this->getTrans($key, $lang);
|
||||
if (!$trans || $trans == '') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $trans;
|
||||
return $trans != '' ? $trans : $this->{$key};
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$key = 'trans_' . $key;
|
||||
if (!empty($this->{$key}[$lang])) {
|
||||
return $this->{$key}[$lang];
|
||||
}
|
||||
$trans = $this->translations->where('language','=', $lang)->where('key', $key)->first();
|
||||
return $trans ? $trans->value : '';
|
||||
}
|
||||
|
||||
public function getTranNames()
|
||||
|
|
@ -573,10 +605,10 @@ class Product extends Model
|
|||
return $this->price;
|
||||
}
|
||||
|
||||
public function getFormattedPriceCurrencyWith(Bool $net = true, Bool $ufactor = true, Country $country = null){
|
||||
public function getFormattedPriceCurrencyWith(Bool $net = true, Bool $ufactor = true, Country $country = null, $commission = false){
|
||||
$ret = "";
|
||||
if($country && isset($country->currency) && $country->currency){
|
||||
$price = $this->getPriceWith($net, $ufactor, $country);
|
||||
$price = $this->getPriceWith($net, $ufactor, $country, $commission);
|
||||
$ret = formatNumber($price * $country->currency_faktor)." ".$country->currency_unit;
|
||||
return '<br><span class="small">~'.$ret.'<span>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,16 +30,14 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereUpdatedAt($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShippingPrice[] $shipping_prices
|
||||
* @property-read int|null $shipping_prices_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\TransShipping> $translations
|
||||
* @property-read int|null $translations_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Shipping extends Model
|
||||
{
|
||||
protected $table = 'shippings';
|
||||
|
||||
protected $casts = [
|
||||
'trans_name' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'active', 'free'
|
||||
];
|
||||
|
|
@ -78,4 +76,25 @@ class Shipping extends Model
|
|||
public function shipping_prices(){
|
||||
return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id');
|
||||
}
|
||||
|
||||
public function translations()
|
||||
{
|
||||
return $this->hasMany(TransShipping::class, 'shipping_id');
|
||||
}
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
$trans = $this->getTrans($key, $lang);
|
||||
return $trans != '' ? $trans : $this->{$key};
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$trans = $this->translations->where('language','=', $lang)->where('key', $key)->first();
|
||||
return $trans ? $trans->value : '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ class ShoppingCollectOrder extends Model
|
|||
public function addTaxToSplit($tax_rate, $add_tax)
|
||||
{
|
||||
$tax_split = $this->tax_split;
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : round($add_tax, 2);
|
||||
$add_tax = round($add_tax, 2);
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : $add_tax;
|
||||
|
||||
foreach($tax_split as $key=>$value){
|
||||
$tax_split[$key] = number_format($value, 2);
|
||||
|
|
@ -129,7 +130,8 @@ class ShoppingCollectOrder extends Model
|
|||
public function addNetToSplit($tax_rate, $add_net)
|
||||
{
|
||||
$net_split = $this->net_split;
|
||||
$net_split[$tax_rate] = isset($net_split[$tax_rate]) ? round($net_split[$tax_rate] += $add_net, 2) : round($add_net, 2);
|
||||
$add_net = round($add_net, 2);
|
||||
$net_split[$tax_rate] = isset($net_split[$tax_rate]) ? round($net_split[$tax_rate] += $add_net, 2) : $add_net;
|
||||
|
||||
foreach($net_split as $key=>$value){
|
||||
$net_split[$key] = number_format($value, 2);
|
||||
|
|
|
|||
|
|
@ -33,17 +33,21 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property string|null $back
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereBack($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereShoppingData($value)
|
||||
* @property string|null $language
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereLanguage($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingInstance extends Model
|
||||
{
|
||||
|
||||
public $paymentTypes = [
|
||||
1 => 'User Shop',
|
||||
1 => 'Customer Shop',
|
||||
2 => 'Berater Shop',
|
||||
3 => 'Berater Membership',
|
||||
4 => 'Berater Wizard',
|
||||
5 => 'Berater Homeparty',
|
||||
6 => 'Berater Shop to Customer Shop',
|
||||
|
||||
];
|
||||
|
||||
protected $table = 'shopping_instances';
|
||||
|
|
@ -51,9 +55,13 @@ class ShoppingInstance extends Model
|
|||
protected $casts = ['shopping_data' => 'array'];
|
||||
|
||||
protected $fillable = [
|
||||
'identifier', 'user_shop_id', 'auth_user_id', 'payment', 'subdomain', 'country_id', 'shopping_data', 'back'
|
||||
'identifier', 'user_shop_id', 'auth_user_id', 'payment', 'subdomain', 'language', 'country_id', 'shopping_data', 'back'
|
||||
];
|
||||
|
||||
public function getLocale(){
|
||||
return $this->language ? $this->language : \App::getLocale();
|
||||
}
|
||||
|
||||
public function user_shop()
|
||||
{
|
||||
return $this->belongsTo('App\Models\UserShop', 'user_shop_id');
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property-read \App\Models\ShoppingCollectOrder|null $shopping_collect_order
|
||||
* @property array|null $net_split
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereNetSplit($value)
|
||||
* @property string|null $language
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereLanguage($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
|
|
@ -111,6 +113,7 @@ class ShoppingOrder extends Model
|
|||
'homeparty_id',
|
||||
'payment_for',
|
||||
'country_id',
|
||||
'language',
|
||||
'user_shop_id',
|
||||
'total',
|
||||
'subtotal',
|
||||
|
|
@ -124,6 +127,8 @@ class ShoppingOrder extends Model
|
|||
'points',
|
||||
'weight',
|
||||
'paid',
|
||||
'is_abo',
|
||||
'abo_interval',
|
||||
'txaction',
|
||||
'wp_invoice_path',
|
||||
'api_notice',
|
||||
|
|
@ -137,15 +142,17 @@ class ShoppingOrder extends Model
|
|||
'api_notice' => 'array',
|
||||
'tax_split' => 'array',
|
||||
'net_split' => 'array',
|
||||
|
||||
'abo_interval' => 'int',
|
||||
'is_abo' => 'bool',
|
||||
];
|
||||
|
||||
public static $shippedTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'in Bearbeitung',
|
||||
2 => 'versendet',
|
||||
3 => 'abgeschlossen',
|
||||
10 => 'storniert'
|
||||
0 => 'open',
|
||||
1 => 'in_process',
|
||||
2 => 'shipped',
|
||||
3 => 'completed',
|
||||
4 => 'trade_fair',
|
||||
10 => 'cancelled'
|
||||
];
|
||||
|
||||
public static $apiShippedTypes = [
|
||||
|
|
@ -153,14 +160,15 @@ class ShoppingOrder extends Model
|
|||
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
|
||||
2 => 'sent', //(Fullfilment durch MIVITA: Versand erfolgt)'
|
||||
3 => 'close', //(Fullfilment durch MIVITA: Versand erfolgt)',
|
||||
4 => 'trade', //(Fullfilment durch MIVITA: Versand erfolgt)',
|
||||
10 => 'cancel'
|
||||
];
|
||||
|
||||
public static $apiStatusTypes = [
|
||||
0 => 'bestellt',
|
||||
1 => 'im Prozess',
|
||||
2 => 'bezahlt',
|
||||
5 => 'entfernt',
|
||||
0 => 'ordered',
|
||||
1 => 'in_process',
|
||||
2 => 'paid',
|
||||
5 => 'removed',
|
||||
];
|
||||
public static $apiStatusColors = [
|
||||
0 => 'warning',
|
||||
|
|
@ -173,19 +181,20 @@ class ShoppingOrder extends Model
|
|||
1 => 'info',
|
||||
2 => 'success',
|
||||
3 => 'secondary',
|
||||
4 => 'secondary',
|
||||
10 => 'danger',
|
||||
];
|
||||
|
||||
public static $paymentForTypes = [
|
||||
0 => '',
|
||||
1 => 'Registrierung',
|
||||
2 => 'Mitgliedschaft',
|
||||
3 => 'Bestellung',
|
||||
4 => 'Kundenbestellung',
|
||||
5 => 'Homeparty',
|
||||
6 => 'Shop',
|
||||
7 => 'extern',
|
||||
8 => 'Sammelrechnung',
|
||||
1 => 'registration',
|
||||
2 => 'membership',
|
||||
3 => 'order',
|
||||
4 => 'customer_order',
|
||||
5 => 'homeparty',
|
||||
6 => 'shop',
|
||||
7 => 'external',
|
||||
8 => 'collective_invoice',
|
||||
10 => '',
|
||||
];
|
||||
|
||||
|
|
@ -273,7 +282,9 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
|
||||
|
||||
public function getLocale(){
|
||||
return $this->language ? $this->language : \App::getLocale();
|
||||
}
|
||||
|
||||
public function setUserHistoryValue($values = []){
|
||||
if($user_history = $this->user_history){
|
||||
|
|
@ -311,7 +322,14 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
public function getShippedType(){
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : "";
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? __('payment.'.self::$shippedTypes[$this->shipped]) : "";
|
||||
}
|
||||
public static function getTransShippedType(){
|
||||
$ret = [];
|
||||
foreach(self::$shippedTypes as $key=>$val){
|
||||
$ret[$key] = trans('payment.'.$val);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getAPIShippedType(){
|
||||
|
|
@ -323,7 +341,7 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
public function getAPIStatusType(){
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? self::$apiStatusTypes[$this->api_status] : "bestellt";
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? __('payment.'.self::$apiStatusTypes[$this->api_status]) : "bestellt";
|
||||
}
|
||||
|
||||
public function getAPIStatusColor(){
|
||||
|
|
@ -381,7 +399,7 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
public function getPaymentForType(){
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : "";
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? __('payment.'.self::$paymentForTypes[$this->payment_for]) : "";
|
||||
}
|
||||
public function getPaymentForColor(){
|
||||
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
|
||||
|
|
@ -579,6 +597,19 @@ class ShoppingOrder extends Model
|
|||
$this->save();
|
||||
}
|
||||
|
||||
public function getShoppingUserFullName(){
|
||||
|
||||
if($this->shopping_user){
|
||||
$fullname = $this->shopping_user->getFullNameAsArray();
|
||||
$ret = "";
|
||||
$ret .= $fullname['company'] ? $fullname['company'].' | ' : '';
|
||||
$ret .= $fullname['salutation'] ? \App\Services\HTMLHelper::getSalutationLang($fullname['salutation']).' ' : '';
|
||||
$ret .= $fullname['firstname'] ? $fullname['firstname'].' ' : '';
|
||||
$ret .= $fullname['lastname'] ? $fullname['lastname'] : '';
|
||||
$ret .= $fullname['email'] ? ' | '.$fullname['email'].'' : '';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ class ShoppingPayment extends Model
|
|||
'reference',
|
||||
'amount',
|
||||
'currency',
|
||||
'mode'
|
||||
'mode',
|
||||
'is_abo',
|
||||
'abo_interval',
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -72,26 +74,26 @@ class ShoppingPayment extends Model
|
|||
|
||||
if($this->clearingtype === 'wlt') {
|
||||
if ($this->wallettype === 'PPE') {
|
||||
return 'PayPal';
|
||||
return __('payment.paypal');
|
||||
}
|
||||
}
|
||||
if($this->clearingtype === 'cc') {
|
||||
return 'Kreditkarte';
|
||||
return __('payment.credit_card');
|
||||
}
|
||||
if($this->clearingtype === 'vor') {
|
||||
return 'Vorkasse';
|
||||
return __('payment.prepayment');
|
||||
}
|
||||
if($this->clearingtype === 'elv') {
|
||||
return 'SEPA Lastschrift';
|
||||
return __('payment.sepa_direct_debit');
|
||||
}
|
||||
if($this->clearingtype === 'sb') {
|
||||
if ($this->onlinebanktransfertype === 'PNT') {
|
||||
return 'Sofort Überweisung';
|
||||
return __('payment.sofort_bank_transfer');
|
||||
}
|
||||
}
|
||||
if($this->clearingtype === 'fnc') {
|
||||
if ($this->onlinebanktransfertype === 'MIV') {
|
||||
return 'Rechnung';
|
||||
return __('payment.purchase_on_account');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereShoppingCollectOrderId($value)
|
||||
* @property string|null $remarks
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereRemarks($value)
|
||||
* @property string|null $language
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereLanguage($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingUser extends Model
|
||||
|
|
@ -134,6 +136,7 @@ class ShoppingUser extends Model
|
|||
'member_id',
|
||||
'number',
|
||||
'is_like',
|
||||
'language',
|
||||
'billing_salutation',
|
||||
'billing_company',
|
||||
'billing_firstname',
|
||||
|
|
@ -215,6 +218,10 @@ class ShoppingUser extends Model
|
|||
return $this->hasOne('App\Models\ShoppingOrder','shopping_user_id');
|
||||
}
|
||||
|
||||
public function getLocale(){
|
||||
return $this->language ? $this->language : \App::getLocale();
|
||||
}
|
||||
|
||||
public function setNotice($key, $value){
|
||||
$notice = $this->notice;
|
||||
$notice[$key] = $value;
|
||||
|
|
@ -262,7 +269,7 @@ class ShoppingUser extends Model
|
|||
case 'membership':
|
||||
return 2;
|
||||
case 'user_order':
|
||||
return $this->is_for === 'me' ? 3 : 4;
|
||||
return ($this->is_for === 'me' || $this->is_for === 'abo_me') ? 3 : 4;
|
||||
case 'homeparty':
|
||||
return 5;
|
||||
case 'shopping':
|
||||
|
|
@ -275,6 +282,18 @@ class ShoppingUser extends Model
|
|||
return 0;
|
||||
}
|
||||
|
||||
public function setIsForAttribute($value){
|
||||
if($value === 'abo-me' || $value === 'me'){
|
||||
$this->attributes['is_for'] = 'me';
|
||||
return;
|
||||
}
|
||||
if($value === 'ot-member' || $value === 'ot-customer' || $value === 'abo-ot-member' || $value === 'abo-ot-customer'){
|
||||
$this->attributes['is_for'] = 'ot';
|
||||
return;
|
||||
}
|
||||
$this->attributes['is_for'] = $value;
|
||||
}
|
||||
|
||||
|
||||
public function getAPIShippedType() {
|
||||
if($this->shopping_order){
|
||||
|
|
@ -282,4 +301,15 @@ class ShoppingUser extends Model
|
|||
}
|
||||
return "free";
|
||||
}
|
||||
|
||||
public function getFullNameAsArray() {
|
||||
return [
|
||||
'company' => $this->billing_company,
|
||||
'salutation' => $this->billing_salutation,
|
||||
'firstname' => $this->billing_firstname,
|
||||
'lastname' => $this->billing_lastname,
|
||||
'email' => $this->billing_email,
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
69
app/Models/ShoppingUserMemberLog.php
Normal file
69
app/Models/ShoppingUserMemberLog.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ShoppingUserMemberLog
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $pre_member_id
|
||||
* @property int $shopping_user_id
|
||||
* @property int $new_member_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property User $user
|
||||
* @property ShoppingUser $shopping_user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog whereNewMemberId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog wherePreMemberId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog whereShoppingUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUserMemberLog whereUpdatedAt($value)
|
||||
* @property-read User $new_member
|
||||
* @property-read User $pre_member
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingUserMemberLog extends Model
|
||||
{
|
||||
protected $table = 'shopping_user_member_logs';
|
||||
|
||||
protected $casts = [
|
||||
'pre_member_id' => 'int',
|
||||
'shopping_user_id' => 'int',
|
||||
'new_member_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'pre_member_id',
|
||||
'shopping_user_id',
|
||||
'new_member_id'
|
||||
];
|
||||
|
||||
public function pre_member()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'pre_member_id');
|
||||
}
|
||||
|
||||
public function new_member()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'new_member_id');
|
||||
}
|
||||
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo(ShoppingUser::class);
|
||||
}
|
||||
}
|
||||
55
app/Models/TransCategory.php
Normal file
55
app/Models/TransCategory.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TransCategory
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $language
|
||||
* @property int $categorie_id
|
||||
* @property string|null $key
|
||||
* @property string|null $value
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category $category
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereCategorieId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereKey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereLanguage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransCategory whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TransCategory extends Model
|
||||
{
|
||||
protected $table = 'trans_categories';
|
||||
|
||||
protected $casts = [
|
||||
'categorie_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'language',
|
||||
'categorie_id',
|
||||
'key',
|
||||
'value'
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'categorie_id');
|
||||
}
|
||||
}
|
||||
55
app/Models/TransIngredient.php
Normal file
55
app/Models/TransIngredient.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TransIngredient
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $language
|
||||
* @property int $ingredient_id
|
||||
* @property string|null $key
|
||||
* @property string|null $value
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Ingredient $ingredient
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereIngredientId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereKey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereLanguage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransIngredient whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TransIngredient extends Model
|
||||
{
|
||||
protected $table = 'trans_ingredients';
|
||||
|
||||
protected $casts = [
|
||||
'ingredient_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'language',
|
||||
'ingredient_id',
|
||||
'key',
|
||||
'value'
|
||||
];
|
||||
|
||||
public function ingredient()
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class);
|
||||
}
|
||||
}
|
||||
57
app/Models/TransProduct.php
Normal file
57
app/Models/TransProduct.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TransProduct
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $language_id
|
||||
* @property int $product_id
|
||||
* @property string|null $key
|
||||
* @property string|null $value
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property TransLanguage $trans_language
|
||||
* @property Product $product
|
||||
* @package App\Models
|
||||
* @property string|null $language
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereKey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereLanguage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TransProduct whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TransProduct extends Model
|
||||
{
|
||||
protected $table = 'trans_products';
|
||||
|
||||
protected $casts = [
|
||||
'product_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'language',
|
||||
'product_id',
|
||||
'key',
|
||||
'value'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue