Updates to 03-2025
This commit is contained in:
parent
bfa3bb1df4
commit
9ae662f63e
243 changed files with 12580 additions and 12018 deletions
|
|
@ -5,10 +5,13 @@ namespace App\Http\Controllers\User;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Repositories\CustomerRepository;
|
||||
use App\Services\AboHelper;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Services\ShoppingUserService;
|
||||
use App\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
|
@ -227,23 +230,51 @@ class CustomerController extends Controller
|
|||
return redirect(route('user_customer_detail', [$shopping_user->id]));
|
||||
}
|
||||
|
||||
|
||||
private function checkShoppingUsersByEmail(){
|
||||
|
||||
//ist an dieser stelle nicht machbar, zu viele Datenbankzugriffe
|
||||
//siehe App\Console\Commands\SyncShoppingUserData
|
||||
/* $user = User::find(\Auth::user()->id);
|
||||
ShoppingUserService::setFakerMail($user);
|
||||
ShoppingUserService::syncNumbersByEmail($user);
|
||||
ShoppingUserService::syncOrdersByEmail($user); */
|
||||
|
||||
}
|
||||
public function getCustomers()
|
||||
{
|
||||
//$this->checkShoppingUsersByEmail();
|
||||
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
//\Log::info('Current user ID: ' . $user->id);
|
||||
|
||||
$query = ShoppingUser::select(['id', 'billing_company', 'billing_salutation', 'billing_firstname', 'billing_lastname', 'billing_email', 'faker_mail', 'billing_zipcode', 'billing_city', 'billing_country_id', 'orders', 'subscribed', 'created_at', 'number', 'mode', 'is_like', 'wp_order_number'])
|
||||
->where('shopping_users.member_id', '=', $user->id);
|
||||
//->groupBy('shopping_users.number');
|
||||
->with('billing_country')
|
||||
->whereIn('id', function($query) {
|
||||
$query->select(DB::raw('MAX(id)'))
|
||||
->from('shopping_users')
|
||||
->groupBy('billing_email');
|
||||
})->where('shopping_users.member_id', '=', $user->id)->where('shopping_users.auth_user_id', '=', NULL);
|
||||
|
||||
/*set_user_attr('filter_member_id', Request::get('filter_member_id'));
|
||||
if(Request::get('filter_member_id') != ""){
|
||||
$query->where('member_id', '=', Request::get('filter_member_id'));
|
||||
}*/
|
||||
if(Request::get('isfor') === 'ot-member'){ //Bestellung für Kunden
|
||||
}
|
||||
if(Request::get('isfor') === 'ot-customer' || Request::get('isfor') === 'abo-ot-customer'){ //Bestellung für Kunden Zahlungslink
|
||||
$query->where(function($q) {
|
||||
$q->where('shopping_users.faker_mail', '!=', 1)
|
||||
->orWhereNull('shopping_users.faker_mail');
|
||||
});
|
||||
}
|
||||
//\Log::info('SQL Query: ' . $query->toSql());
|
||||
//\Log::info('Query Bindings: ' . print_r($query->getBindings(), true));
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('send_to', function (ShoppingUser $ShoppingUser) {
|
||||
$ot = Request::get('isfor') ? Request::get('isfor') : 'ot-member';
|
||||
if(Request::get('isfor') === 'abo-ot-customer' && AboHelper::memberHasAbo($ShoppingUser)){
|
||||
return '<span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> '.__('abo.abo_assigned').'</span>';
|
||||
}
|
||||
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) {
|
||||
|
|
@ -262,7 +293,7 @@ class CustomerController extends Controller
|
|||
return $ShoppingUser->firstEntryByNumber()->created_at->format('d.m.Y');
|
||||
})
|
||||
->addColumn('orders', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->lastEntryByNumber()->orders;
|
||||
return $ShoppingUser->orders;
|
||||
})
|
||||
->addColumn('subscribed', function (ShoppingUser $ShoppingUser) {
|
||||
return get_active_badge($ShoppingUser->subscribed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue