23-01-2026
This commit is contained in:
parent
a939cd51ef
commit
a8b395e20d
248 changed files with 29342 additions and 4805 deletions
|
|
@ -270,7 +270,9 @@ class AboController extends Controller
|
|||
->addColumn('name', function (Product $product) use ($user_abo) {
|
||||
return '<strong>' . $product->getLang('name') . '</strong><br>' . get_abo_type_badge_by_product($product);
|
||||
})
|
||||
|
||||
->addColumn('points', function (Product $product) use ($user_abo) {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPoints() . '</span>';
|
||||
})
|
||||
->addColumn('price_net', function (Product $product) use ($user_abo) {
|
||||
$ufactor = $user_abo->is_for === 'me' ? true : false;
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(true, $ufactor, Yard::instance('shopping')->getUserCountry()) . " €</span>" . '<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()) . '</span>';
|
||||
|
|
@ -298,7 +300,7 @@ class AboController extends Controller
|
|||
->orderColumn('contents_total', 'contents_total $1')
|
||||
->orderColumn('weight', 'weight $1')
|
||||
|
||||
->rawColumns(['add_card', 'product', 'name', 'quantity', 'picture', 'price_net', 'price_gross', 'action'])
|
||||
->rawColumns(['add_card', 'points', 'product', 'name', 'quantity', 'picture', 'price_net', 'price_gross', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use Auth;
|
||||
use Yard;
|
||||
use Request;
|
||||
|
|
@ -38,35 +39,35 @@ class HomepartyController extends Controller
|
|||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id === 'new'){
|
||||
if ($id === 'new') {
|
||||
$homeparty = new Homeparty();
|
||||
$homeparty->id = 0;
|
||||
$step = 1;
|
||||
}else{
|
||||
} else {
|
||||
$homeparty = $this->getHomparty($id);
|
||||
if($homeparty->step < 10){
|
||||
if ($homeparty->step < 10) {
|
||||
$step = $homeparty->step;
|
||||
}else{
|
||||
if(!$step){
|
||||
} else {
|
||||
if (!$step) {
|
||||
$step = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($homeparty->homeparty_host){
|
||||
if ($homeparty->homeparty_host) {
|
||||
$homeparty_user = $homeparty->homeparty_host;
|
||||
}else{
|
||||
} else {
|
||||
$homeparty_user = new HomepartyUser();
|
||||
$homeparty_user->is_host = true;
|
||||
}
|
||||
|
||||
if($homeparty->completed){
|
||||
if ($homeparty->completed) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'homeparty' => $homeparty,
|
||||
'homeparty_user' => $homeparty_user,
|
||||
'step' => $step,
|
||||
'homeparty' => $homeparty,
|
||||
'homeparty_user' => $homeparty_user,
|
||||
'step' => $step,
|
||||
|
||||
];
|
||||
return view('user.homeparty.detail', $data);
|
||||
|
|
@ -76,13 +77,13 @@ class HomepartyController extends Controller
|
|||
{
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'homeparty-party-store-detail'){
|
||||
if ($data['action'] === 'homeparty-party-store-detail') {
|
||||
$rules = array(
|
||||
'date' => 'required',
|
||||
'name' => 'required',
|
||||
'place' => 'required',
|
||||
);
|
||||
if(!$id){
|
||||
if (!$id) {
|
||||
$rules = array(
|
||||
'date' => 'required',
|
||||
'name' => 'required',
|
||||
|
|
@ -91,7 +92,7 @@ class HomepartyController extends Controller
|
|||
);
|
||||
}
|
||||
}
|
||||
if($data['action'] === 'homeparty-party-store-address'){
|
||||
if ($data['action'] === 'homeparty-party-store-address') {
|
||||
$rules = array(
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
|
|
@ -103,7 +104,7 @@ class HomepartyController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if($data['action'] === 'homeparty-party-store-host'){
|
||||
if ($data['action'] === 'homeparty-party-store-host') {
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
'billing_firstname' => 'required',
|
||||
|
|
@ -118,13 +119,13 @@ class HomepartyController extends Controller
|
|||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if($data['action'] === 'homeparty-party-store-detail'){
|
||||
if(!$id){
|
||||
|
||||
if ($data['action'] === 'homeparty-party-store-detail') {
|
||||
if (!$id) {
|
||||
//first save create and empty user/host
|
||||
do {
|
||||
$token = Util::uuidToken();
|
||||
} while( Homeparty::where('token', $token)->count() );
|
||||
} while (Homeparty::where('token', $token)->count());
|
||||
$data['token'] = $token;
|
||||
$data['auth_user_id'] = \Auth::user()->id;
|
||||
$data['step'] = 2;
|
||||
|
|
@ -139,35 +140,35 @@ class HomepartyController extends Controller
|
|||
'same_as_billing' => false,
|
||||
'is_host' => true,
|
||||
]);
|
||||
}else {
|
||||
} else {
|
||||
$homeparty = $this->getHomparty($id);
|
||||
$homeparty->fill($data)->save();
|
||||
$this->storeTranslations($homeparty, \App::getLocale(), $data);
|
||||
$step = 10;
|
||||
}
|
||||
}
|
||||
if($data['action'] === 'homeparty-party-store-address'){
|
||||
if ($data['action'] === 'homeparty-party-store-address') {
|
||||
$homeparty = $this->getHomparty($id);
|
||||
$homeparty_user = $homeparty->homeparty_host;
|
||||
$homeparty_user->fill($data)->save();
|
||||
if($homeparty->step === 2){
|
||||
if ($homeparty->step === 2) {
|
||||
$homeparty->step = 3;
|
||||
$homeparty->save();
|
||||
$step = 3;
|
||||
}else{
|
||||
} else {
|
||||
$step = 12;
|
||||
}
|
||||
}
|
||||
|
||||
if($data['action'] === 'homeparty-party-store-host'){
|
||||
if ($data['action'] === 'homeparty-party-store-host') {
|
||||
$homeparty = $this->getHomparty($id);
|
||||
$homeparty_user = $homeparty->homeparty_host;
|
||||
$homeparty_user->fill($data)->save();
|
||||
if($homeparty->step === 3){
|
||||
if ($homeparty->step === 3) {
|
||||
$homeparty->step = 10;
|
||||
$homeparty->save();
|
||||
$step = 10;
|
||||
}else{
|
||||
} else {
|
||||
$step = 13;
|
||||
}
|
||||
}
|
||||
|
|
@ -176,9 +177,10 @@ class HomepartyController extends Controller
|
|||
return redirect(route('user_homeparty_detail', [$homeparty->id, $step]));
|
||||
}
|
||||
|
||||
private function storeTranslations($homeparty, $lang, $data){
|
||||
private function storeTranslations($homeparty, $lang, $data)
|
||||
{
|
||||
|
||||
if($lang == 'de'){
|
||||
if ($lang == 'de') {
|
||||
$homeparty->description = $data['description'];
|
||||
$homeparty->save();
|
||||
return;
|
||||
|
|
@ -204,18 +206,18 @@ class HomepartyController extends Controller
|
|||
public function guestDetail($id = null, $gid = null)
|
||||
{
|
||||
$homeparty = $this->getHomparty($id);
|
||||
if($gid === 'new'){
|
||||
if ($gid === 'new') {
|
||||
$homeparty_user = new HomepartyUser();
|
||||
$homeparty_user->same_as_billing = true;
|
||||
$homeparty_user->billing_country_id = $homeparty->country_id;
|
||||
$homeparty_user->shipping_country_id = $homeparty->country_id;
|
||||
}else{
|
||||
} else {
|
||||
$homeparty_user = HomepartyUser::findOrFail($gid);
|
||||
if($homeparty->id !== $homeparty_user->homeparty_id){
|
||||
if ($homeparty->id !== $homeparty_user->homeparty_id) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
if($homeparty->completed){
|
||||
if ($homeparty->completed) {
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
|
|
@ -254,16 +256,16 @@ class HomepartyController extends Controller
|
|||
}
|
||||
|
||||
$homeparty = $this->getHomparty($id);
|
||||
if($gid === null){
|
||||
if ($gid === null) {
|
||||
$homeparty_user = HomepartyUser::create([
|
||||
'homeparty_id' => $homeparty->id,
|
||||
'auth_user_id' => \Auth::user()->id,
|
||||
'is_host' => false,
|
||||
]);
|
||||
}else{
|
||||
]);
|
||||
} else {
|
||||
$homeparty_user = HomepartyUser::findOrFail($gid);
|
||||
}
|
||||
if($homeparty->id !== $homeparty_user->homeparty_id){
|
||||
if ($homeparty->id !== $homeparty_user->homeparty_id) {
|
||||
abort(404);
|
||||
}
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
|
|
@ -279,12 +281,12 @@ class HomepartyController extends Controller
|
|||
$user = User::find(Auth::user()->id);
|
||||
$homeparty = $this->getHomparty($id);
|
||||
$shipping_country_id = $this->checkShoppingCountry($homeparty->country_id);
|
||||
if(!$shipping_country_id){
|
||||
if (!$shipping_country_id) {
|
||||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_homepartys'));
|
||||
}
|
||||
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
|
||||
if($this->userChangeCountry($homeparty)){
|
||||
if ($this->userChangeCountry($homeparty)) {
|
||||
\Session()->flash('custom-error', __('msg.country_account_has_been_changed__cost_has_been_reset'));
|
||||
return redirect(route('user_homeparty_order', [$homeparty->id]));
|
||||
}
|
||||
|
|
@ -299,24 +301,26 @@ class HomepartyController extends Controller
|
|||
return view('user.homeparty.order', $data);
|
||||
}
|
||||
|
||||
private function userChangeCountry($homeparty){
|
||||
if(isset($homeparty->card_info['user_country_id'])){
|
||||
if($homeparty->card_info['user_country_id'] !== UserService::$user_country->id){
|
||||
private function userChangeCountry($homeparty)
|
||||
{
|
||||
if (isset($homeparty->card_info['user_country_id'])) {
|
||||
if ($homeparty->card_info['user_country_id'] !== UserService::$user_country->id) {
|
||||
// es wurde schon eine order angelegt, aber das Rechungsland geändert
|
||||
if($homeparty->homeparty_order_items->count()){
|
||||
foreach($homeparty->homeparty_order_items as $homeparty_order_item){
|
||||
if ($homeparty->homeparty_order_items->count()) {
|
||||
foreach ($homeparty->homeparty_order_items as $homeparty_order_item) {
|
||||
$homeparty_order_item->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkShoppingCountry($country_id){
|
||||
if($country_id){
|
||||
if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){
|
||||
private function checkShoppingCountry($country_id)
|
||||
{
|
||||
if ($country_id) {
|
||||
if ($shipping_country = ShippingCountry::whereCountryId($country_id)->first()) {
|
||||
return $shipping_country->id;
|
||||
}
|
||||
}
|
||||
|
|
@ -328,26 +332,26 @@ class HomepartyController extends Controller
|
|||
{
|
||||
$homeparty = $this->getHomparty($id);
|
||||
|
||||
if(Request::ajax()) {
|
||||
if (Request::ajax()) {
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'addProduct') {
|
||||
if($data['homeparty_id'] == $homeparty->id){
|
||||
if ($data['action'] === 'addProduct') {
|
||||
if ($data['homeparty_id'] == $homeparty->id) {
|
||||
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
|
||||
if($homeparty_user->homeparty_id !== $homeparty->id){
|
||||
if ($homeparty_user->homeparty_id !== $homeparty->id) {
|
||||
abort(404);
|
||||
}
|
||||
if($product = Product::find($data['product_id'])){
|
||||
if ($product = Product::find($data['product_id'])) {
|
||||
$margin = 0;
|
||||
if(\Auth::user() && \Auth::user()->user_level){
|
||||
if (\Auth::user() && \Auth::user()->user_level) {
|
||||
$margin = \Auth::user()->user_level->margin;
|
||||
}
|
||||
$HomepartyUserOrderItem = HomepartyUserOrderItem::where('homeparty_user_id', $homeparty_user->id)->where('product_id', $product->id)->first();
|
||||
if($HomepartyUserOrderItem){
|
||||
$HomepartyUserOrderItem->qty = $HomepartyUserOrderItem->qty+1;
|
||||
if ($HomepartyUserOrderItem) {
|
||||
$HomepartyUserOrderItem->qty = $HomepartyUserOrderItem->qty + 1;
|
||||
$HomepartyUserOrderItem->save();
|
||||
}else{
|
||||
if($homeparty->getCardInfo('user_tax_free')){
|
||||
} else {
|
||||
if ($homeparty->getCardInfo('user_tax_free')) {
|
||||
$HomepartyUserOrderItem = HomepartyUserOrderItem::create([
|
||||
'homeparty_id' => $homeparty->id,
|
||||
'homeparty_user_id' => $homeparty_user->id,
|
||||
|
|
@ -362,7 +366,7 @@ class HomepartyController extends Controller
|
|||
'ek_price_net' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
|
||||
'slug' => $product->slug
|
||||
]);
|
||||
}else{
|
||||
} else {
|
||||
$HomepartyUserOrderItem = HomepartyUserOrderItem::create([
|
||||
'homeparty_id' => $homeparty->id,
|
||||
'homeparty_user_id' => $homeparty_user->id,
|
||||
|
|
@ -379,9 +383,7 @@ class HomepartyController extends Controller
|
|||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
|
||||
HomepartyCart::calculateHomeparty($homeparty);
|
||||
|
|
@ -389,18 +391,18 @@ class HomepartyController extends Controller
|
|||
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
|
||||
$html_host_bonus = view("user.homeparty.show_calc_bonus_host", ['homeparty' => $homeparty])->render();
|
||||
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
|
||||
return response()->json(['response' => true, 'data' => $data, 'html_user_cart' => $html_user_cart, 'html_bonus' => $html_bonus, 'html_host_bonus' => $html_host_bonus, 'html_total' => $html_total]);
|
||||
}
|
||||
|
||||
if($data['action'] === 'updateCart') {
|
||||
if($data['homeparty_id'] == $homeparty->id){
|
||||
if ($data['action'] === 'updateCart') {
|
||||
if ($data['homeparty_id'] == $homeparty->id) {
|
||||
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
|
||||
if($homeparty_user->homeparty_id !== $homeparty->id){
|
||||
if ($homeparty_user->homeparty_id !== $homeparty->id) {
|
||||
abort(404);
|
||||
}
|
||||
if(isset($data['product_id']) && $product = Product::find($data['product_id'])){
|
||||
if(isset($data['order_item_id']) && $HomepartyUserOrderItem = HomepartyUserOrderItem::find($data['order_item_id'])){
|
||||
if(isset($data['qty'])){
|
||||
if (isset($data['product_id']) && $product = Product::find($data['product_id'])) {
|
||||
if (isset($data['order_item_id']) && $HomepartyUserOrderItem = HomepartyUserOrderItem::find($data['order_item_id'])) {
|
||||
if (isset($data['qty'])) {
|
||||
$qty = (int) $data['qty'];
|
||||
$qty = $qty < 1 ? 1 : $qty;
|
||||
$qty = $qty > 100 ? 100 : $qty;
|
||||
|
|
@ -416,17 +418,17 @@ class HomepartyController extends Controller
|
|||
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
|
||||
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
|
||||
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
|
||||
return response()->json(['response' => true, 'data' => $data, 'html_user_cart' => $html_user_cart, 'html_bonus' => $html_bonus, 'html_host_bonus' => $html_host_bonus, 'html_total' => $html_total]);
|
||||
}
|
||||
|
||||
if($data['action'] === 'removeFromCart') {
|
||||
if($data['homeparty_id'] == $homeparty->id){
|
||||
if ($data['action'] === 'removeFromCart') {
|
||||
if ($data['homeparty_id'] == $homeparty->id) {
|
||||
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
|
||||
if($homeparty_user->homeparty_id !== $homeparty->id){
|
||||
if ($homeparty_user->homeparty_id !== $homeparty->id) {
|
||||
abort(404);
|
||||
}
|
||||
if(isset($data['product_id']) && $product = Product::find($data['product_id'])){
|
||||
if(isset($data['order_item_id']) && $HomepartyUserOrderItem = HomepartyUserOrderItem::find($data['order_item_id'])){
|
||||
if (isset($data['product_id']) && $product = Product::find($data['product_id'])) {
|
||||
if (isset($data['order_item_id']) && $HomepartyUserOrderItem = HomepartyUserOrderItem::find($data['order_item_id'])) {
|
||||
$HomepartyUserOrderItem->delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -437,16 +439,16 @@ class HomepartyController extends Controller
|
|||
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
|
||||
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
|
||||
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
|
||||
return response()->json(['response' => true, 'data' => $data, 'html_user_cart' => $html_user_cart, 'html_bonus' => $html_bonus, 'html_host_bonus' => $html_host_bonus, 'html_total' => $html_total]);
|
||||
}
|
||||
|
||||
if($data['action'] === 'updateDeliveryOption') {
|
||||
if($data['homeparty_id'] == $homeparty->id){
|
||||
if ($data['action'] === 'updateDeliveryOption') {
|
||||
if ($data['homeparty_id'] == $homeparty->id) {
|
||||
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
|
||||
if($homeparty_user->homeparty_id !== $homeparty->id){
|
||||
if ($homeparty_user->homeparty_id !== $homeparty->id) {
|
||||
abort(404);
|
||||
}
|
||||
if(isset($data['delivery'])){
|
||||
if (isset($data['delivery'])) {
|
||||
$homeparty_user->delivery = $data['delivery'];
|
||||
$homeparty_user->save();
|
||||
}
|
||||
|
|
@ -457,17 +459,17 @@ class HomepartyController extends Controller
|
|||
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
|
||||
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
|
||||
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
|
||||
return response()->json(['response' => true, 'data' => $data, 'html_user_cart' => $html_user_cart, 'html_bonus' => $html_bonus, 'html_host_bonus' => $html_host_bonus, 'html_total' => $html_total]);
|
||||
}
|
||||
|
||||
|
||||
return response()->json(['response' => false, 'data'=>$data]);
|
||||
return response()->json(['response' => false, 'data' => $data]);
|
||||
}
|
||||
|
||||
HomepartyCart::calculateHomeparty($homeparty);
|
||||
if(\App\Services\HomepartyCart::$price === 0){
|
||||
\Session()->flash('alert-error', __('msg.your_shopping_cart_is_empty_please_add_products_first'));
|
||||
return redirect(route('user_homeparty_order', [$homeparty->id]));
|
||||
if (\App\Services\HomepartyCart::$price === 0) {
|
||||
\Session()->flash('alert-error', __('msg.your_shopping_cart_is_empty_please_add_products_first'));
|
||||
return redirect(route('user_homeparty_order', [$homeparty->id]));
|
||||
}
|
||||
|
||||
//save the calucalte card!
|
||||
|
|
@ -475,29 +477,29 @@ class HomepartyController extends Controller
|
|||
$date = date('d.m.Y H:i:s', $time);
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
$cartItem = Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$ek_price, false, false, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
$cartItem = Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty ' . $date, 1, \App\Services\HomepartyCart::$ek_price, false, false, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
} while (ShoppingInstance::where('identifier', $identifier)->count());
|
||||
|
||||
HomepartyCart::store($identifier, $date);
|
||||
|
||||
$data = [];
|
||||
$data['is_from'] = 'homeparty';
|
||||
|
||||
if($homeparty->getCardInfo('user_tax_free')){
|
||||
if ($homeparty->getCardInfo('user_tax_free')) {
|
||||
$data['shop_price'] = HomepartyCart::getFormattedEkPrice();
|
||||
$data['shop_price_net'] = HomepartyCart::getFormattedEkPrice();
|
||||
$data['shop_price_tax'] = 0;
|
||||
$data['user_tax_free'] = true;
|
||||
}else{
|
||||
} else {
|
||||
$data['shop_price'] = HomepartyCart::getFormattedEkPrice();
|
||||
$data['shop_price_net'] = HomepartyCart::getFormattedEkPriceNet();
|
||||
$data['shop_price_tax'] = HomepartyCart::getFormattedEkPriceTax();
|
||||
$data['user_tax_free'] = false;
|
||||
}
|
||||
|
||||
|
||||
$data['homeparty_id'] = $homeparty->id;
|
||||
$data['is_for'] = 'hp';
|
||||
$data['user_price_infos'] = $homeparty->card_info;
|
||||
|
|
@ -518,68 +520,68 @@ class HomepartyController extends Controller
|
|||
HomepartyCart::store($identifier, $date);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'payment_homeparty', 'status'=>1, 'referenz'=>$homeparty->id, 'identifier'=>$identifier]);
|
||||
$path = route('checkout.checkout_card', ['identifier' => $identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action' => 'payment_homeparty', 'status' => 1, 'referenz' => $homeparty->id, 'identifier' => $identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
}
|
||||
|
||||
|
||||
public function delete($do, $id = null, $gid=null)
|
||||
public function delete($do, $id = null, $gid = null)
|
||||
{
|
||||
$homeparty = $this->getHomparty($id);
|
||||
|
||||
if($do === 'hpu'){
|
||||
if ($do === 'hpu') {
|
||||
$homeparty_user = HomepartyUser::findOrFail($gid);
|
||||
if($homeparty->id !== $homeparty_user->homeparty_id){
|
||||
if ($homeparty->id !== $homeparty_user->homeparty_id) {
|
||||
abort(404);
|
||||
}
|
||||
if($homeparty_user->homeparty_user_order_items){
|
||||
foreach($homeparty_user->homeparty_user_order_items as $homeparty_user_order_item){
|
||||
$homeparty_user_order_item->delete();
|
||||
if ($homeparty_user->homeparty_user_order_items) {
|
||||
foreach ($homeparty_user->homeparty_user_order_items as $homeparty_user_order_item) {
|
||||
$homeparty_user_order_item->delete();
|
||||
}
|
||||
}
|
||||
//$homeparty_user->save();
|
||||
$homeparty_user->delete();
|
||||
\Session()->flash('alert-success', __('msg.homeparty_guest_delete'));
|
||||
return redirect(route('user_homeparty_guests', [$homeparty->id]));
|
||||
|
||||
}
|
||||
if($do === 'hp') {
|
||||
if ($do === 'hp') {
|
||||
|
||||
foreach ($homeparty->homeparty_users as $homeparty_user){
|
||||
foreach ($homeparty->homeparty_users as $homeparty_user) {
|
||||
if ($homeparty->id !== $homeparty_user->homeparty_id) {
|
||||
abort(404);
|
||||
}
|
||||
if($homeparty_user->homeparty_user_order_items){
|
||||
foreach($homeparty_user->homeparty_user_order_items as $homeparty_user_order_item){
|
||||
$homeparty_user_order_item->delete();
|
||||
if ($homeparty_user->homeparty_user_order_items) {
|
||||
foreach ($homeparty_user->homeparty_user_order_items as $homeparty_user_order_item) {
|
||||
$homeparty_user_order_item->delete();
|
||||
}
|
||||
}
|
||||
$homeparty_user->delete();
|
||||
}
|
||||
if($homeparty->homeparty_order_items){
|
||||
foreach($homeparty->homeparty_order_items as $homeparty_order_item){
|
||||
$homeparty_order_item->delete();
|
||||
if ($homeparty->homeparty_order_items) {
|
||||
foreach ($homeparty->homeparty_order_items as $homeparty_order_item) {
|
||||
$homeparty_order_item->delete();
|
||||
}
|
||||
}
|
||||
$homeparty->delete();
|
||||
\Session()->flash('alert-success', __('msg.homeparty_delete'));
|
||||
return redirect(route('user_homepartys'));
|
||||
|
||||
}
|
||||
abort(404);
|
||||
}
|
||||
|
||||
private function getHomparty($id){
|
||||
private function getHomparty($id)
|
||||
{
|
||||
$homeparty = Homeparty::findOrFail($id);
|
||||
if($homeparty->auth_user_id !== \Auth::user()->id){
|
||||
if ($homeparty->auth_user_id !== \Auth::user()->id) {
|
||||
abort(404);
|
||||
}
|
||||
return $homeparty;
|
||||
}
|
||||
|
||||
public function datatable($homeparty_id){
|
||||
public function datatable($homeparty_id)
|
||||
{
|
||||
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '4');
|
||||
$homeparty = Homeparty::findOrFail($homeparty_id);
|
||||
|
|
@ -587,20 +589,19 @@ class HomepartyController extends Controller
|
|||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('add_card', function (Product $product) use ($homeparty) {
|
||||
if($homeparty->getCardInfo('user_tax_free')){
|
||||
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="'.$product->id.'">
|
||||
<strong>€ '.$product->getFormattedPriceWith(true, false, $homeparty->getUserCountry()).'</strong> +<span class="ion ion-md-cart"></span>
|
||||
if ($homeparty->getCardInfo('user_tax_free')) {
|
||||
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="' . $product->id . '">
|
||||
<strong>€ ' . $product->getFormattedPriceWith(true, false, $homeparty->getUserCountry()) . '</strong> +<span class="ion ion-md-cart"></span>
|
||||
</button>';
|
||||
}else{
|
||||
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="'.$product->id.'">
|
||||
<strong>€ '.$product->getFormattedPriceWith(false, false, $homeparty->getUserCountry()).'</strong> +<span class="ion ion-md-cart"></span>
|
||||
} else {
|
||||
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="' . $product->id . '">
|
||||
<strong>€ ' . $product->getFormattedPriceWith(false, false, $homeparty->getUserCountry()) . '</strong> +<span class="ion ion-md-cart"></span>
|
||||
</button>';
|
||||
}
|
||||
|
||||
})
|
||||
->addColumn('picture', function (Product $product) {
|
||||
if(count($product->images)){
|
||||
return '<img class="img-fluid img-extra" alt="" src="'.route('product_image', [$product->images->first()->slug]).'">';
|
||||
if (count($product->images)) {
|
||||
return '<img class="img-fluid img-extra" alt="" src="' . route('product_image', [$product->images->first()->slug]) . '">';
|
||||
}
|
||||
return "";
|
||||
})
|
||||
|
|
@ -609,32 +610,35 @@ class HomepartyController extends Controller
|
|||
'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, true, $homeparty->getUserCountry()).'</span>';
|
||||
})
|
||||
*/
|
||||
->addColumn('points', function (Product $product) use ($homeparty) {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPoints() . '</span>';
|
||||
})
|
||||
->addColumn('price_gross', function (Product $product) use ($homeparty) {
|
||||
if($homeparty->getCardInfo('user_tax_free')){
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, true, $homeparty->getUserCountry()). " €</span>".
|
||||
'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, true, $homeparty->getUserCountry()).'</span>';
|
||||
}else{
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, true, $homeparty->getUserCountry()). " €</span>".
|
||||
'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, true, $homeparty->getUserCountry()).'</span>';
|
||||
if ($homeparty->getCardInfo('user_tax_free')) {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(true, true, $homeparty->getUserCountry()) . " €</span>" .
|
||||
'<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, true, $homeparty->getUserCountry()) . '</span>';
|
||||
} else {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(false, true, $homeparty->getUserCountry()) . " €</span>" .
|
||||
'<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(false, true, $homeparty->getUserCountry()) . '</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('price_vk_gross', function (Product $product) use ($homeparty) {
|
||||
if($homeparty->getCardInfo('user_tax_free')){
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, $homeparty->getUserCountry()). " €</span>".
|
||||
'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, $homeparty->getUserCountry()).'</span>';
|
||||
}else{
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, $homeparty->getUserCountry()). " €</span>".
|
||||
'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, $homeparty->getUserCountry()).'</span>';
|
||||
if ($homeparty->getCardInfo('user_tax_free')) {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(true, false, $homeparty->getUserCountry()) . " €</span>" .
|
||||
'<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, false, $homeparty->getUserCountry()) . '</span>';
|
||||
} else {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(false, false, $homeparty->getUserCountry()) . " €</span>" .
|
||||
'<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(false, false, $homeparty->getUserCountry()) . '</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').'"
|
||||
data-toggle="modal" data-target="#modals-load-content" data-id="' . $product->id . '" data-route="' . route('modal_load') . '"
|
||||
data-action="user-order-show-product" data-view="customer"><i class="ion ion-md-eye"></i></button>';
|
||||
})
|
||||
->filterColumn('product', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('name', 'LIKE', '%'.$keyword.'%');
|
||||
->filterColumn('product', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->where('name', 'LIKE', '%' . $keyword . '%');
|
||||
}
|
||||
})
|
||||
->orderColumn('name', 'name $1')
|
||||
|
|
@ -647,8 +651,7 @@ class HomepartyController extends Controller
|
|||
->orderColumn('contents_total', 'contents_total $1')
|
||||
->orderColumn('weight', 'weight $1')
|
||||
|
||||
->rawColumns(['add_card', 'product', 'quantity', 'picture', 'price_net', 'price_gross', 'price_vk_gross', 'action'])
|
||||
->rawColumns(['add_card', 'points', 'product', 'quantity', 'picture', 'price_net', 'price_gross', 'price_vk_gross', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,17 +44,16 @@ class OrderController extends Controller
|
|||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
|
||||
|
||||
if ($shopping_order->auth_user_id !== $user->id) {
|
||||
Log::channel(self::LOG_CHANNEL)->warning("Unauthorized access attempt to order #{$id} by user #{$user->id}");
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
||||
if ($shopping_order->payment_for === 6 || $shopping_order->payment_for === 7) {
|
||||
Log::channel(self::LOG_CHANNEL)->info("Redirecting user #{$user->id} to customer order detail for order #{$id}");
|
||||
return redirect(route('user_shop_order_detail', [$shopping_order->id]));
|
||||
}
|
||||
|
||||
|
||||
$shopping_order->getLastShoppingPayment();
|
||||
|
||||
return view('user.order.detail', [
|
||||
|
|
@ -73,7 +72,7 @@ class OrderController extends Controller
|
|||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="'.route('user_order_detail', [$ShoppingOrder->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
return '<a href="' . route('user_order_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->created_at->format("d.m.Y");
|
||||
|
|
@ -82,7 +81,7 @@ class OrderController extends Controller
|
|||
return Payment::getShoppingOrderBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()." €</span>";
|
||||
return '<span class="no-line-break">' . $ShoppingOrder->getFormattedTotalShipping() . " €</span>";
|
||||
})
|
||||
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
|
|
@ -90,21 +89,21 @@ class OrderController extends Controller
|
|||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
if ($ShoppingOrder->payment_for === 8) {
|
||||
return '<button type="button" class="btn btn-xs btn-info btn-round" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$ShoppingOrder->id.'"
|
||||
data-id="' . $ShoppingOrder->id . '"
|
||||
data-action="shop-user-order-shipping-detail"
|
||||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="fa 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>';
|
||||
return '<span class="badge badge-pill badge-' . $ShoppingOrder->getShippedColor() . '">' . $ShoppingOrder->getShippedType() . '</span>';
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return Payment::getPaymentForBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
|
||||
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
|
||||
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="' . route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']) . '" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
|
||||
<a href="' . route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']) . '" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
|
|
@ -126,27 +125,26 @@ class OrderController extends Controller
|
|||
$user = User::find(Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
|
||||
|
||||
if (strpos($for, 'ot') !== false) {
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
|
||||
|
||||
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'));
|
||||
Log::channel(self::LOG_CHANNEL)->warning("Shipping country not found for user #{$user->id}, country: {$country}");
|
||||
\Session()->flash('custom-error', $country . ": " . __('validation.custom.shipping_not_found'));
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping country not found for user #{$user->id}, country: {$country}");
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
|
||||
|
||||
if ($for === 'abo-ot-customer') {
|
||||
if (AboHelper::hasAboByEmail($shopping_user->billing_email) && !\Session()->has('custom-error')) {
|
||||
\Session()->flash('custom-error', __('abo.error_email_has_abo', ['email' => $shopping_user->billing_email]));
|
||||
Log::channel(self::LOG_CHANNEL)->info("User #{$user->id} attempted to create abo for email that already has one: {$shopping_user->billing_email}");
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Request::get('action') === 'next') {
|
||||
Yard::instance('shopping')->destroy();
|
||||
if (strpos(Request::get('switchers-radio-is-for'), 'ot') !== false) {
|
||||
|
|
@ -154,7 +152,7 @@ class OrderController extends Controller
|
|||
}
|
||||
return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id]));
|
||||
}
|
||||
|
||||
|
||||
return view('user.order.delivery', [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => false,
|
||||
|
|
@ -167,33 +165,33 @@ class OrderController extends Controller
|
|||
public function list($for, $id = null)
|
||||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
||||
|
||||
if ($for === 'abo-me' && AboHelper::userHasAbo($user)) {
|
||||
Log::channel(self::LOG_CHANNEL)->warning("User #{$user->id} attempted to create abo but already has one");
|
||||
Log::channel(self::LOG_CHANNEL)->error("User #{$user->id} attempted to create abo but already has one");
|
||||
abort(403, 'User has an Abo. Cannot order.');
|
||||
}
|
||||
|
||||
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
|
||||
|
||||
if (strpos($for, 'ot') !== false) {
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
}
|
||||
|
||||
|
||||
if ($for === 'ot-customer' || $for === 'abo-ot-customer') {
|
||||
UserService::initCustomerYard($shopping_user, $for);
|
||||
} else {
|
||||
$shipping_country_id = Shop::checkShoppingCountry($for, $id);
|
||||
if (!$shipping_country_id) {
|
||||
$country = Shop::getDeliveryCountry($for, $id);
|
||||
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
|
||||
\Session()->flash('custom-error', $country . ": " . __('validation.custom.shipping_not_found'));
|
||||
Log::channel(self::LOG_CHANNEL)->warning("Shipping country not found for user #{$user->id}, country: {$country}");
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
UserService::initUserYard($user, $shipping_country_id, $for);
|
||||
}
|
||||
|
||||
|
||||
return view('user.order.list', [
|
||||
'shopping_user' => $shopping_user,
|
||||
'user' => $user,
|
||||
|
|
@ -211,7 +209,7 @@ class OrderController extends Controller
|
|||
{
|
||||
$data = Request::all();
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
||||
|
||||
$rules = [
|
||||
'shipping_salutation' => 'required',
|
||||
'shipping_firstname' => 'required',
|
||||
|
|
@ -221,14 +219,13 @@ class OrderController extends Controller
|
|||
'shipping_city' => 'required',
|
||||
'shipping_state' => 'required',
|
||||
];
|
||||
|
||||
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
|
||||
if ($validator->fails()) {
|
||||
Log::channel(self::LOG_CHANNEL)->info("Validation failed for payment form", ['errors' => $validator->errors()->toArray()]);
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$this->checkSendYardForPayment($data, $id);
|
||||
} catch (\Exception $e) {
|
||||
|
|
@ -243,28 +240,22 @@ class OrderController extends Controller
|
|||
if (Yard::instance('shopping')->getNumComp() > 0) {
|
||||
if (!isset($data['switchers-comp-product'])) {
|
||||
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product not selected");
|
||||
} else if (!is_array($data['switchers-comp-product'])) {
|
||||
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product selection is not an array");
|
||||
} else if (count($data['switchers-comp-product']) !== Yard::instance('shopping')->getNumComp()) {
|
||||
$validator->errors()->add('switchers-comp-product', __('mdg.please_select_count_compensation_products', ['count' => Yard::instance('shopping')->getNumComp()]));
|
||||
Log::channel(self::LOG_CHANNEL)->info("Incorrect number of compensation products selected", [
|
||||
'required' => Yard::instance('shopping')->getNumComp(),
|
||||
'selected' => count($data['switchers-comp-product'])
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
if ($validator->errors()->count()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Generate unique identifier
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while (ShoppingInstance::where('identifier', $identifier)->count());
|
||||
|
||||
|
||||
// Prepare common data
|
||||
$data['is_from'] = 'user_order';
|
||||
$data['is_for'] = $for;
|
||||
|
|
@ -273,17 +264,11 @@ class OrderController extends Controller
|
|||
$data['shopping_user_id'] = $id;
|
||||
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
|
||||
$data['mode'] = config('app.mode') === 'test' ? 'test' : 'live';
|
||||
|
||||
|
||||
// Remove unnecessary data
|
||||
unset($data['quantity']);
|
||||
unset($data['_token']);
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Processing payment for user #{$user->id}", [
|
||||
'for' => $for,
|
||||
'identifier' => $identifier,
|
||||
'is_abo' => $data['is_abo']
|
||||
]);
|
||||
|
||||
|
||||
if ($for === 'ot-customer' || $for === 'abo-ot-customer') {
|
||||
return $this->processCustomerPayment($user, $identifier, $data, $id, $for);
|
||||
} else {
|
||||
|
|
@ -309,30 +294,26 @@ class OrderController extends Controller
|
|||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
]);
|
||||
|
||||
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
$yard_shopping_items = OrderPaymentService::getRestoredYardShoppingItems($shopping_instance);
|
||||
|
||||
// Send Mail to Customer
|
||||
try {
|
||||
$this->customPaymentSendMail($user, $identifier, $yard_shopping_items, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Custom payment email sent successfully", [
|
||||
'identifier' => $identifier,
|
||||
'user_id' => $user->id
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
Log::channel(self::LOG_CHANNEL)->error("Failed to send custom payment email: " . $e->getMessage(), [
|
||||
'identifier' => $identifier,
|
||||
'user_id' => $user->id
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
UserHistory::create([
|
||||
'user_id' => $user->id,
|
||||
'action' => 'user_order_customer',
|
||||
'status' => 1,
|
||||
'product_id' => null,
|
||||
'identifier' => $identifier,
|
||||
'user_id' => $user->id,
|
||||
'action' => 'user_order_customer',
|
||||
'status' => 1,
|
||||
'product_id' => null,
|
||||
'identifier' => $identifier,
|
||||
'is_abo' => $data['is_abo']
|
||||
]);
|
||||
|
||||
|
|
@ -359,18 +340,18 @@ class OrderController extends Controller
|
|||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
]);
|
||||
|
||||
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
|
||||
UserHistory::create([
|
||||
'user_id' => $user->id,
|
||||
'action' => 'user_order_payment',
|
||||
'status' => 1,
|
||||
'product_id' => null,
|
||||
'identifier' => $identifier,
|
||||
'user_id' => $user->id,
|
||||
'action' => 'user_order_payment',
|
||||
'status' => 1,
|
||||
'product_id' => null,
|
||||
'identifier' => $identifier,
|
||||
'is_abo' => $data['is_abo']
|
||||
]);
|
||||
|
||||
|
||||
$path = route('checkout.checkout_card', ['identifier' => $identifier]);
|
||||
return redirect()->secure($path);
|
||||
}
|
||||
|
|
@ -382,7 +363,7 @@ class OrderController extends Controller
|
|||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
|
||||
|
||||
if (strpos($data['shipping_is_for'], 'ot') !== false) {
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
}
|
||||
|
|
@ -396,13 +377,13 @@ class OrderController extends Controller
|
|||
'shopping_user_id' => $id,
|
||||
'yard_identifier' => $identifier
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'no shipping_country_id found | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping country not found", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('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);
|
||||
|
|
@ -414,10 +395,10 @@ class OrderController extends Controller
|
|||
'expected' => $shipping_country_id,
|
||||
'actual' => Yard::instance('shopping')->getShippingCountryId()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'shipping_country_id is not the same from Yard | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping country mismatch", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.shipping_country_was_not_correctly'));
|
||||
}
|
||||
|
||||
|
|
@ -430,14 +411,14 @@ class OrderController extends Controller
|
|||
'shopping_user_id' => $id,
|
||||
'yard_identifier' => $identifier
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard can by not shipping_free | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Yard cannot be shipping free", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.shopping_cart_was_shipping_free'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($data['shipping_is_for'] === 'ot-customer') {
|
||||
if (!$user->shop) {
|
||||
$identifier = 'error-' . time() . mt_rand(1000000, 9999999);
|
||||
|
|
@ -447,16 +428,16 @@ class OrderController extends Controller
|
|||
'shopping_user_id' => $id,
|
||||
'yard_identifier' => $identifier
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'User has no Shop for an User to Customer order| Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("User has no shop for customer order", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.shopping_cart_was_not_user_shop'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$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) {
|
||||
|
|
@ -468,13 +449,13 @@ class OrderController extends Controller
|
|||
'yard_identifier' => $identifier,
|
||||
'weight' => Yard::instance('shopping')->weight()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is 0 | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping price cannot be zero for order with weight", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('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);
|
||||
|
|
@ -485,14 +466,14 @@ class OrderController extends Controller
|
|||
'expected' => $shipping_price->price,
|
||||
'actual' => Yard::instance('shopping')->getShippingPrice()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is not the same from shipping_price | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping price mismatch", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('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);
|
||||
|
|
@ -503,14 +484,14 @@ class OrderController extends Controller
|
|||
'yard_identifier' => $identifier,
|
||||
'weight' => Yard::instance('shopping')->weight()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is 0 | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping price cannot be zero for personal order with weight", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.shipping_cost_cannot_be_0'));
|
||||
}
|
||||
|
||||
if(Shop::isCompProducts($data['shipping_is_for'])){
|
||||
|
||||
if (Shop::isCompProducts($data['shipping_is_for'])) {
|
||||
if (Yard::instance('shopping')->getShippingPrice() != $shipping_price->price_comp) {
|
||||
$identifier = 'error-' . time() . mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
|
@ -521,13 +502,13 @@ class OrderController extends Controller
|
|||
'expected' => $shipping_price->price_comp,
|
||||
'actual' => Yard::instance('shopping')->getShippingPrice()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price with comp products | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping price mismatch for personal order", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('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);
|
||||
|
|
@ -538,13 +519,13 @@ class OrderController extends Controller
|
|||
'expected' => $shipping_price->num_comp,
|
||||
'actual' => Yard::instance('shopping')->getNumComp()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard num_comp is not correct | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Compensation product count mismatch", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.compensation_products_cannot_be_0'));
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if (Yard::instance('shopping')->getShippingPrice() != $shipping_price->price) {
|
||||
$identifier = 'error-' . time() . mt_rand(1000000, 9999999);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
|
@ -555,14 +536,13 @@ class OrderController extends Controller
|
|||
'expected' => $shipping_price->price,
|
||||
'actual' => Yard::instance('shopping')->getShippingPrice()
|
||||
];
|
||||
|
||||
|
||||
MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price without comp products | Yard identifier: ' . $identifier, $data);
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shipping price mismatch for personal order", $logData);
|
||||
|
||||
|
||||
throw new \Exception(__('msg.shipping_costs_were_not_calculated_correctly'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -570,60 +550,58 @@ class OrderController extends Controller
|
|||
{
|
||||
$isAbo = Request::get('is_abo');
|
||||
$shippingIsFor = Request::get('shipping_is_for');
|
||||
|
||||
|
||||
if ($shippingIsFor === 'me' || $shippingIsFor === 'abo-me') {
|
||||
$show_on_ids = $isAbo ? ['12', '13'] : ['2'];
|
||||
|
||||
|
||||
$query = Product::with('product_buyings')
|
||||
->select('products.*')
|
||||
->where('products.active', true)
|
||||
->where(function($q) use ($show_on_ids) {
|
||||
->where(function ($q) use ($show_on_ids) {
|
||||
foreach ($show_on_ids as $id) {
|
||||
$q->orWhereJsonContains('show_on', $id);
|
||||
}
|
||||
})
|
||||
->orderByRaw("CASE
|
||||
->orderByRaw(
|
||||
"CASE
|
||||
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
|
||||
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
|
||||
ELSE 3 END",
|
||||
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
|
||||
ELSE 3 END",
|
||||
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]
|
||||
);
|
||||
} else {
|
||||
$show_on_ids = $isAbo ? ['12', '13'] : ['3'];
|
||||
|
||||
|
||||
$query = Product::select('products.*')
|
||||
->where('active', true)
|
||||
->where(function($q) use ($show_on_ids) {
|
||||
->where(function ($q) use ($show_on_ids) {
|
||||
foreach ($show_on_ids as $id) {
|
||||
$q->orWhereJsonContains('show_on', $id);
|
||||
}
|
||||
})
|
||||
->orderByRaw("CASE
|
||||
->orderByRaw(
|
||||
"CASE
|
||||
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
|
||||
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
|
||||
ELSE 3 END",
|
||||
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
|
||||
ELSE 3 END",
|
||||
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]
|
||||
);
|
||||
}
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Datatable query executed", [
|
||||
'is_abo' => $isAbo,
|
||||
'shipping_is_for' => $shippingIsFor,
|
||||
'show_on_ids' => $show_on_ids
|
||||
]);
|
||||
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('product', function (Product $product) {
|
||||
$cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
|
||||
$qty = isset($cartItem->qty) ? $cartItem->qty : 0;
|
||||
$rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
|
||||
return '<strong>'.$product->getLang('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">
|
||||
<button type="button" class="btn btn-secondary icon-btn md-btn-extra remove-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">-</button>
|
||||
<button type="button" class="btn btn-secondary icon-btn md-btn-extra remove-product-basket" data-row-id="' . $rowId . '" data-product-id="' . $product->id . '">-</button>
|
||||
</span>
|
||||
<input type="text" class="form-control text-center input-extra table-input-event-onchange" name="product_qty_'.$product->id.'" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'" value="'.$qty.'">
|
||||
<input type="text" class="form-control text-center input-extra table-input-event-onchange" name="product_qty_' . $product->id . '" data-row-id="' . $rowId . '" data-product-id="' . $product->id . '" value="' . $qty . '">
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary icon-btn md-btn-extra add-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">+</button>
|
||||
<button type="button" class="btn btn-secondary icon-btn md-btn-extra add-product-basket" data-row-id="' . $rowId . '" data-product-id="' . $product->id . '">+</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>';
|
||||
|
|
@ -632,37 +610,40 @@ class OrderController extends Controller
|
|||
return AboHelper::getAboTypeBadge(AboHelper::getAboShowOn($product));
|
||||
})
|
||||
->addColumn('picture', function (Product $product) {
|
||||
if(count($product->images)){
|
||||
return '<img class="img-fluid img-extra" alt="" src="'.route('product_image', [$product->images->first()->slug]).'">';
|
||||
if (count($product->images)) {
|
||||
return '<img class="img-fluid img-extra" alt="" src="' . route('product_image', [$product->images->first()->slug]) . '">';
|
||||
}
|
||||
return "";
|
||||
})
|
||||
->addColumn('points', function (Product $product) {
|
||||
return '<span class="no-line-break">' . $product->getFormattedPoints() . '</span>';
|
||||
})
|
||||
->addColumn('price_net', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, true, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()).'</span>';
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(true, true, Yard::instance('shopping')->getUserCountry()) . " €</span>" . '<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()) . '</span>';
|
||||
})
|
||||
->addColumn('price_gross', function (Product $product) {
|
||||
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, true, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, true, Yard::instance('shopping')->getUserCountry()).'</span>';
|
||||
return '<span class="no-line-break">' . $product->getFormattedPriceWith(false, true, Yard::instance('shopping')->getUserCountry()) . " €</span>" . '<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(false, true, Yard::instance('shopping')->getUserCountry()) . '</span>';
|
||||
})
|
||||
->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>';
|
||||
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>';
|
||||
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>';
|
||||
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>';
|
||||
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').'"
|
||||
data-toggle="modal" data-target="#modals-load-content" data-id="' . $product->id . '" data-route="' . route('modal_load') . '"
|
||||
data-action="user-order-show-product" data-view="customer"><i class="ion ion-md-eye"></i></button>';
|
||||
})
|
||||
->filterColumn('product', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('name', 'LIKE', '%'.$keyword.'%');
|
||||
->filterColumn('product', function ($query, $keyword) {
|
||||
if ($keyword != "") {
|
||||
$query->where('name', 'LIKE', '%' . $keyword . '%');
|
||||
}
|
||||
})
|
||||
->orderColumn('name', 'name $1')
|
||||
|
|
@ -678,7 +659,7 @@ class OrderController extends Controller
|
|||
->orderColumn('contents_total', 'contents_total $1')
|
||||
->orderColumn('weight', 'weight $1')
|
||||
->orderColumn('abo', 'show_on $1')
|
||||
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'customer_price_net', 'customer_price_gross', 'my_commission_net', 'product', 'quantity', 'picture', 'abo', 'action'])
|
||||
->rawColumns(['add_card', 'points', 'price_net', 'price_gross', 'price_vk_gross', 'customer_price_net', 'customer_price_gross', 'my_commission_net', 'product', 'quantity', 'picture', 'abo', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +672,7 @@ class OrderController extends Controller
|
|||
Log::channel(self::LOG_CHANNEL)->warning("Non-AJAX request to performRequest method");
|
||||
return response()->json(['response' => false, 'message' => 'Only AJAX requests are allowed']);
|
||||
}
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot-member';
|
||||
$data['for'] = $is_for;
|
||||
|
|
@ -705,17 +686,16 @@ class OrderController extends Controller
|
|||
if ($data['action'] === 'updateCart' && isset($data['product_id'])) {
|
||||
return $this->handleUpdateCart($data, $is_for);
|
||||
}
|
||||
|
||||
|
||||
if ($data['action'] === 'clearCart') {
|
||||
Yard::instance('shopping')->destroy();
|
||||
Log::channel(self::LOG_CHANNEL)->info("Cart cleared");
|
||||
return response()->json(['response' => true, 'data' => Yard::instance('shopping')->count(), 'html_card' => '', 'html_comp' => '']);
|
||||
}
|
||||
|
||||
if ($data['action'] === 'updateShippingCountry') {
|
||||
return $this->handleUpdateShippingCountry($data, $is_for);
|
||||
}
|
||||
|
||||
|
||||
if ($data['action'] === 'updateCompProduct') {
|
||||
return $this->handleUpdateCompProduct($data, $is_for);
|
||||
}
|
||||
|
|
@ -743,41 +723,44 @@ class OrderController extends Controller
|
|||
// Get the cart item
|
||||
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, 'show_on' => $product->show_on]);
|
||||
->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, 'show_on' => $product->show_on]
|
||||
);
|
||||
} 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, 'show_on' => $product->show_on]);
|
||||
->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, 'show_on' => $product->show_on]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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']);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Cart item updated", [
|
||||
'product_id' => $product->id,
|
||||
'product_name' => $product->getLang('name'),
|
||||
'qty' => $data['qty']
|
||||
]);
|
||||
} else {
|
||||
// If 0 get the item by qty:1 and remove it
|
||||
Yard::instance('shopping')->remove($cartItem->rowId);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Cart item removed", [
|
||||
'product_id' => $product->id,
|
||||
'product_name' => $product->getLang('name')
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
|
||||
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
$html_comp = view("user.order.comp_product", $data)->render();
|
||||
|
||||
|
|
@ -794,21 +777,16 @@ class OrderController extends Controller
|
|||
if ($shipping_country) {
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for);
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Shipping country updated", [
|
||||
'shipping_country_id' => $shipping_country->id,
|
||||
'shipping_country_name' => $shipping_country->name ?? 'unknown'
|
||||
]);
|
||||
} else {
|
||||
Log::channel(self::LOG_CHANNEL)->warning("Shipping country not found", [
|
||||
'shipping_country_id' => $data['shipping_country_id']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
$html_comp = view("user.order.comp_product", $data)->render();
|
||||
|
||||
|
||||
return response()->json(['response' => true, 'data' => $data, 'html_card' => $html_card, 'html_comp' => $html_comp]);
|
||||
}
|
||||
|
||||
|
|
@ -819,13 +797,7 @@ class OrderController extends Controller
|
|||
{
|
||||
$this->updateCompProduct($data);
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product updated", [
|
||||
'comp_product_id' => $data['comp_product_id'] ?? null,
|
||||
'comp_num' => $data['comp_num'] ?? null,
|
||||
'count_comp_products' => $data['count_comp_products'] ?? null
|
||||
]);
|
||||
|
||||
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
$html_comp = view("user.order.comp_product", $data)->render();
|
||||
|
||||
|
|
@ -841,12 +813,6 @@ class OrderController extends Controller
|
|||
// If equal or greater, delete due to new shipping costs
|
||||
if ($row->options->comp && $row->options->comp > intval($count_comp_products)) {
|
||||
Yard::instance('shopping')->remove($row->rowId);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product removed due to count change", [
|
||||
'product_id' => $row->id,
|
||||
'product_name' => $row->name,
|
||||
'comp_value' => $row->options->comp,
|
||||
'required_comp' => $count_comp_products
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -864,13 +830,6 @@ class OrderController extends Controller
|
|||
//comp_num welches comp product wird hinzugefügt
|
||||
if ($row->options->comp && ($row->options->comp == intval($data['comp_num']) || $row->options->comp > intval($data['count_comp_products']))) {
|
||||
Yard::instance('shopping')->remove($row->rowId);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product removed during update", [
|
||||
'product_id' => $row->id,
|
||||
'product_name' => $row->name,
|
||||
'comp_value' => $row->options->comp,
|
||||
'comp_num' => $data['comp_num'],
|
||||
'count_comp_products' => $data['count_comp_products']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -881,23 +840,24 @@ class OrderController extends Controller
|
|||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, false, false, [
|
||||
'image' => $image,
|
||||
'slug' => $product->slug,
|
||||
'weight' => 0,
|
||||
$cartItem = Yard::instance('shopping')->add(
|
||||
$product->id,
|
||||
$product->getLang('name'),
|
||||
1,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
[
|
||||
'image' => $image,
|
||||
'slug' => $product->slug,
|
||||
'weight' => 0,
|
||||
'points' => 0,
|
||||
'comp' => intval($data['comp_num']),
|
||||
'comp' => intval($data['comp_num']),
|
||||
'product_id' => $product->id
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Compensation product added", [
|
||||
'product_id' => $product->id,
|
||||
'product_name' => $product->getLang('name'),
|
||||
'comp_num' => $data['comp_num']
|
||||
]);
|
||||
} else {
|
||||
Log::channel(self::LOG_CHANNEL)->warning("Compensation product not found", [
|
||||
'comp_product_id' => $data['comp_product_id']
|
||||
|
|
@ -913,7 +873,6 @@ class OrderController extends Controller
|
|||
{
|
||||
try {
|
||||
$data = OrderPaymentService::getCustomPayment($identifier);
|
||||
Log::channel(self::LOG_CHANNEL)->info("Custom payment page accessed", ['identifier' => $identifier]);
|
||||
return view('user.order.payment.custom_payment', $data);
|
||||
} catch (\Exception $e) {
|
||||
Log::channel(self::LOG_CHANNEL)->error("Error accessing custom payment: " . $e->getMessage(), ['identifier' => $identifier]);
|
||||
|
|
@ -928,38 +887,32 @@ class OrderController extends Controller
|
|||
{
|
||||
$bcc = [];
|
||||
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
|
||||
|
||||
|
||||
if (!$shopping_instance) {
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shopping instance not found for email", ['identifier' => $identifier]);
|
||||
throw new \Exception(__('msg.shopping_instance_not_found'));
|
||||
}
|
||||
|
||||
|
||||
$shopping_user = $data['shopping_user_id'] ? ShoppingUser::find($data['shopping_user_id']) : null;
|
||||
|
||||
|
||||
if (!$shopping_user) {
|
||||
Log::channel(self::LOG_CHANNEL)->error("Shopping user not found for email", ['shopping_user_id' => $data['shopping_user_id']]);
|
||||
throw new \Exception(__('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;
|
||||
|
||||
Log::channel(self::LOG_CHANNEL)->info("Sending custom payment email", [
|
||||
'to' => $billing_email,
|
||||
'bcc' => $bcc,
|
||||
'identifier' => $identifier
|
||||
]);
|
||||
|
||||
Mail::to($billing_email)
|
||||
->bcc($bcc)
|
||||
->locale(\App::getLocale())
|
||||
->send(new MailCustomPaymet($route, $shopping_user, $shopping_instance, $yard_shopping_items, $data['mode']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use App\Services\BusinessPlan\TreeCalcBot;
|
|||
use App\Services\BusinessPlan\TreeCalcBotOptimized;
|
||||
use App\Services\BusinessPlan\TreeHelperOptimized;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Services\LevelReportService;
|
||||
use App\Services\NextLevelBadgeHelper;
|
||||
use App\Services\TranslationHelper;
|
||||
use App\User;
|
||||
|
|
@ -134,7 +135,7 @@ class TeamController extends Controller
|
|||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if (config('app.debug')) {
|
||||
$user = User::find(454);
|
||||
// $user = User::find(454);
|
||||
}
|
||||
$this->setFilterVars();
|
||||
|
||||
|
|
@ -491,6 +492,141 @@ class TeamController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeigt Level-Aufstieg Reports für das eigene Team
|
||||
* Nur für einen ausgewählten Monat/Jahr basierend auf TreeCalcBotOptimized
|
||||
*/
|
||||
public function levelReports(Request $request)
|
||||
{
|
||||
$startTime = microtime(true);
|
||||
|
||||
try {
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$this->setFilterVars();
|
||||
|
||||
// Monat und Jahr aus Request oder Session
|
||||
$month = Request::get('month') ?: session('team_user_filter_month_prev', intval(date('m') - 1));
|
||||
$year = Request::get('year') ?: session('team_user_filter_year', date('Y'));
|
||||
$onlyNotUpdated = Request::boolean('not_updated', false);
|
||||
|
||||
// Prüfe ob Live-Berechnung erzwungen werden soll
|
||||
$forceLiveCalculation = false; //Request::get('force_live_calculation', false) || Request::get('live', false);
|
||||
|
||||
\Log::info("TeamController: Building level reports for user {$user->id} ({$month}/{$year})");
|
||||
|
||||
// Lade Team-Struktur mit TreeCalcBotOptimized
|
||||
$treeCalcBot = new TreeCalcBotOptimized($month, $year, 'member', $forceLiveCalculation);
|
||||
$treeCalcBot->initStructureUser($user->id, $forceLiveCalculation);
|
||||
|
||||
// Lade Level-Reports für Team
|
||||
$levelReportService = new LevelReportService();
|
||||
$filters = ['only_not_updated' => $onlyNotUpdated];
|
||||
$promotions = $levelReportService->getTeamLevelPromotions($treeCalcBot, $month, $year, $filters);
|
||||
$statistics = $levelReportService->getStatistics($promotions);
|
||||
|
||||
$endTime = microtime(true);
|
||||
$executionTime = round(($endTime - $startTime) * 1000, 2);
|
||||
|
||||
\Log::info("TeamController: Level reports loaded for user {$user->id} in {$executionTime}ms - " . $promotions->count() . " promotions found");
|
||||
|
||||
$availableYears = range(date('Y'), date('Y') - 5);
|
||||
$availableMonths = [
|
||||
1 => __('cal.months.January'),
|
||||
2 => __('cal.months.February'),
|
||||
3 => __('cal.months.March'),
|
||||
4 => __('cal.months.April'),
|
||||
5 => __('cal.months.May'),
|
||||
6 => __('cal.months.June'),
|
||||
7 => __('cal.months.July'),
|
||||
8 => __('cal.months.August'),
|
||||
9 => __('cal.months.September'),
|
||||
10 => __('cal.months.October'),
|
||||
11 => __('cal.months.November'),
|
||||
12 => __('cal.months.December')
|
||||
];
|
||||
|
||||
$data = [
|
||||
'promotions' => $promotions,
|
||||
'statistics' => $statistics,
|
||||
'filters' => [
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'only_not_updated' => $onlyNotUpdated
|
||||
],
|
||||
'availableYears' => $availableYears,
|
||||
'availableMonths' => $availableMonths,
|
||||
'performance' => [
|
||||
'execution_time' => $executionTime,
|
||||
'user_id' => $user->id
|
||||
]
|
||||
];
|
||||
|
||||
return view('user.team.level-reports', $data);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error("TeamController: Error loading level reports: " . $e->getMessage());
|
||||
|
||||
return view('user.team.level-reports', [
|
||||
'error' => 'Fehler beim Laden der Level-Reports: ' . $e->getMessage(),
|
||||
'promotions' => collect([]),
|
||||
'statistics' => ['total_count' => 0, 'level_stats' => [], 'period_stats' => []],
|
||||
'filters' => ['month' => date('m'), 'year' => date('Y'), 'only_not_updated' => false],
|
||||
'availableYears' => range(date('Y'), date('Y') - 5),
|
||||
'availableMonths' => [
|
||||
1 => __('cal.months.January'),
|
||||
2 => __('cal.months.February'),
|
||||
3 => __('cal.months.March'),
|
||||
4 => __('cal.months.April'),
|
||||
5 => __('cal.months.May'),
|
||||
6 => __('cal.months.June'),
|
||||
7 => __('cal.months.July'),
|
||||
8 => __('cal.months.August'),
|
||||
9 => __('cal.months.September'),
|
||||
10 => __('cal.months.October'),
|
||||
11 => __('cal.months.November'),
|
||||
12 => __('cal.months.December')
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSV Export für Team Level-Reports
|
||||
*/
|
||||
public function levelReportsExport(Request $request)
|
||||
{
|
||||
try {
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$this->setFilterVars();
|
||||
|
||||
$month = Request::get('month') ?: session('team_user_filter_month_prev', intval(date('m') - 1));
|
||||
$year = Request::get('year') ?: session('team_user_filter_year', date('Y'));
|
||||
$onlyNotUpdated = Request::boolean('not_updated', false);
|
||||
$forceLiveCalculation = Request::get('force_live_calculation', false) || Request::get('live', false);
|
||||
|
||||
// Lade Team-Struktur
|
||||
$treeCalcBot = new TreeCalcBotOptimized($month, $year, 'member', $forceLiveCalculation);
|
||||
$treeCalcBot->initStructureUser($user->id, $forceLiveCalculation);
|
||||
|
||||
// Lade Level-Reports
|
||||
$levelReportService = new LevelReportService();
|
||||
$filters = ['only_not_updated' => $onlyNotUpdated];
|
||||
$promotions = $levelReportService->getTeamLevelPromotions($treeCalcBot, $month, $year, $filters);
|
||||
|
||||
if ($promotions->isEmpty()) {
|
||||
return redirect()->back()->with('error', 'Keine Daten für Export gefunden.');
|
||||
}
|
||||
|
||||
// CSV erstellen
|
||||
$filename = 'team_level_promotions_' . date('Y-m-d_H-i-s') . '.csv';
|
||||
$filepath = $levelReportService->exportToCsv($promotions, $filename);
|
||||
|
||||
return response()->download($filepath, $filename)->deleteFileAfterSend(true);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error("TeamController: Error exporting level reports: " . $e->getMessage());
|
||||
return redirect()->back()->with('error', 'Fehler beim Export: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeigt den Marketingplan für User an
|
||||
* Übersichtliche Darstellung aller Karriere-Level mit wichtigen Informationen
|
||||
|
|
@ -553,6 +689,94 @@ class TeamController extends Controller
|
|||
return view('user.team.members', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeigt die Abos der Team-Mitglieder an
|
||||
*/
|
||||
public function showAbos()
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$this->setFilterVars();
|
||||
|
||||
// Nutze TreeCalcBotOptimized um das Team zu bekommen
|
||||
$month = session('team_user_filter_month');
|
||||
$year = session('team_user_filter_year');
|
||||
|
||||
// Lade Team-Struktur
|
||||
$TreeCalcBot = new TreeCalcBotOptimized($month, $year, 'member', false);
|
||||
$TreeCalcBot->initStructureUser($user->id, false);
|
||||
|
||||
// Hole flache Liste aller Team-Mitglieder
|
||||
$teamUsersRaw = $this->getTeamUsersFromStructure($TreeCalcBot);
|
||||
|
||||
// Sammle User-IDs für Abo-Abfrage
|
||||
$teamUserIds = [];
|
||||
foreach ($teamUsersRaw as $teamUser) {
|
||||
if ($teamUser->user_id && $teamUser->user_id != $user->id) {
|
||||
$teamUserIds[] = $teamUser->user_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Hole Abos der Team-Mitglieder
|
||||
$abos = \App\Models\UserAbo::whereIn('user_id', $teamUserIds)
|
||||
->where('is_for', 'me')
|
||||
->with(['user', 'user.account', 'user_abo_items', 'user_abo_items.product'])
|
||||
->orderBy('next_date', 'asc')
|
||||
->get();
|
||||
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
'abos' => $abos,
|
||||
];
|
||||
|
||||
return view('user.team.abos', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeigt die Detail-Ansicht eines Team-Abos an
|
||||
*/
|
||||
public function detailAbo($id)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$user_abo = \App\Models\UserAbo::findOrFail($id);
|
||||
|
||||
// Prüfe ob das Abo zu einem Team-Mitglied gehört
|
||||
$this->setFilterVars();
|
||||
$month = session('team_user_filter_month');
|
||||
$year = session('team_user_filter_year');
|
||||
|
||||
$TreeCalcBot = new TreeCalcBotOptimized($month, $year, 'member', false);
|
||||
$TreeCalcBot->initStructureUser($user->id, false);
|
||||
|
||||
$teamUsersRaw = $this->getTeamUsersFromStructure($TreeCalcBot);
|
||||
$teamUserIds = [];
|
||||
foreach ($teamUsersRaw as $teamUser) {
|
||||
if ($teamUser->user_id) {
|
||||
$teamUserIds[] = $teamUser->user_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Prüfe Berechtigung
|
||||
if (!in_array($user_abo->user_id, $teamUserIds)) {
|
||||
abort(403, 'Unauthorized action. This subscription does not belong to your team.');
|
||||
}
|
||||
|
||||
// Lade Abo-Details (ähnlich wie AboController)
|
||||
\App\Services\AboOrderCart::initYard($user_abo);
|
||||
$customer_detail = \App\Services\AboOrderCart::getCustomerDetail();
|
||||
\App\Services\AboOrderCart::makeOrderYard($user_abo);
|
||||
|
||||
$data = [
|
||||
'user_abo' => $user_abo,
|
||||
'isAdmin' => false,
|
||||
'customer_detail' => $customer_detail,
|
||||
'view' => 'team',
|
||||
'comp_products' => [],
|
||||
];
|
||||
|
||||
return view('user.team.abo_detail', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisiert die Team-Suche für den eingeloggten User
|
||||
*/
|
||||
|
|
@ -674,6 +898,9 @@ class TeamController extends Controller
|
|||
if (!session('team_user_filter_month')) {
|
||||
session(['team_user_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if (!session('team_user_filter_month_prev')) {
|
||||
session(['team_user_filter_month_prev' => intval(date('m') - 1)]);
|
||||
}
|
||||
if (!session('team_user_filter_year')) {
|
||||
session(['team_user_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
|
@ -696,6 +923,9 @@ class TeamController extends Controller
|
|||
if (Request::get('team_user_filter_month')) {
|
||||
session(['team_user_filter_month' => Request::get('team_user_filter_month')]);
|
||||
}
|
||||
if (Request::get('team_user_filter_month_prev')) {
|
||||
session(['team_user_filter_month_prev' => Request::get('team_user_filter_month_prev')]);
|
||||
}
|
||||
if (Request::get('team_user_filter_year')) {
|
||||
session(['team_user_filter_year' => Request::get('team_user_filter_year')]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue