This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -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);
}