This commit is contained in:
Kevin Adametz 2022-06-15 18:08:45 +02:00
parent 9b0b5feb7e
commit 7a040c3e19
106 changed files with 4074 additions and 1349 deletions

View file

@ -100,6 +100,9 @@ class AdminUserController extends Controller
if(isset($data['save-active'])){
$data['active'] = isset($data['active']) ? true : false;
$user->active = $data['active'];
if($data['active'] === true && $user->wizard < 20){
$user->wizard = 20;
}
if($data['active']){
if(!isset($data['active_date']) || $data['active_date'] == ""){
$user->active_date = now();

View file

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Product as ModelsProduct;
use Vitalybaev\GoogleMerchant\Feed;
use Vitalybaev\GoogleMerchant\Product;
use Vitalybaev\GoogleMerchant\Product\Shipping;
use Vitalybaev\GoogleMerchant\Product\Availability\Availability;
use App\Services\Util;
class GoogleMerchantController extends Controller
{
public function __construct()
{
}
public function feed(){
$products = ModelsProduct::where('active', true)->whereJsonContains('show_on', '1')->orderBy('pos', 'DESC')->get();
// Create feed object
$feed = new Feed("mivita shop", "https://mivita.shop", "Bio Aloe Vera & Naturkosmetuk");
// Put products to the feed ($products - some data from database for example)
foreach ($products as $product) {
$item = new Product();
// Set common product properties
$item->setId($product->id);
$item->setTitle($product->name);
$item->setDescription($product->copy);
$item->setLink($product->getProductUrl());
$item->setImage($product->getImageUrl());
$item->setAvailability(Availability::IN_STOCK);
/*if ($product->isAvailable()) {
$item->setAvailability(Availability::IN_STOCK);
} else {
$item->setAvailability(Availability::OUT_OF_STOCK);
}*/
$item->setPrice("{$product->price} EUR");
//$item->setGoogleCategory($product->category_name);
$item->setBrand('MIVITA');
$item->setGtin($product->ean);
$item->setCondition('new');
// Some additional properties
//$item->setColor($product->color);
//$item->setSize($product->size);
// Shipping info
/*
$shipping = new Shipping();
$shipping->setCountry('US');
$shipping->setRegion('CA, NSW, 03');
$shipping->setPostalCode('94043');
$shipping->setLocationId('21137');
$shipping->setService('DHL');
$shipping->setPrice('1300 USD');
$item->setShipping($shipping);
*/
// Set a custom shipping label and weight (optional)
//$item->setShippingLabel('ups-ground');
//$item->setShippingWeight('2.14');
// Set a custom label (optional)
$item->setCustomLabel($product->weight, 'product_width');
$item->setCustomLabel($product->contents_total, 'product_contents_total');
$item->setCustomLabel($product->getUnitType(), 'product_contents_unit',);
$item->setCustomLabel($product->contents_str, 'product_contents');
$item->setCustomLabel($product->ingredients, 'product_ingredients');
$item->setCustomLabel($product->getBasePriceFormattedFullWith(false, false, null), 'product_base_pricing_unit');
//$item->setCustomLabel('Some Label 2', 1);
// Add this product to the feed
$feed->addProduct($item);
}
// Here we get complete XML of the feed, that we could write to file or send directly
$feedXml = $feed->build();
print ($feedXml);
}
// http://api.mivita.test/google/merchant/feed
}

View file

@ -593,7 +593,7 @@ class ShoppingUserController extends Controller
if ($order->price != ($product->price * 100)) {
$error[] = "different price: " . ($product->price * 100);
}
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
}
}
$order->message = $error;
@ -662,7 +662,7 @@ class ShoppingUserController extends Controller
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug,
])->save();
@ -687,7 +687,7 @@ class ShoppingUserController extends Controller
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
]);

View file

@ -0,0 +1,234 @@
<?php
namespace App\Http\Controllers;
use App\Services\BusinessPlan\TreeCalcBot;
use Request;
use App\User;
use Carbon\Carbon;
use App\Services\HTMLHelper;
class BusinessController extends Controller
{
private $filter_active = [1 => 'aktiv', 2 => 'nicht aktiv', 3 => 'alle'];
public function __construct()
{
$this->middleware('admin');
}
public function show()
{
$this->setFilterVars();
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(),
'filter_active' => $this->filter_active,
];
return view('admin.business.show', $data);
}
public function structure()
{
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('business_user_filter_month'), session('business_user_filter_year'), 'admin');
$TreeCalcBot->initMain();
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(),
'TreeCalcBot' => $TreeCalcBot,
];
return view('admin.business.structure', $data);
}
public function userDetail($user_id)
{
$user = User::findOrFail($user_id);
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('business_user_filter_month'), session('business_user_filter_year'), 'admin');
$TreeCalcBot->initDetailUser($user);
if(!$TreeCalcBot->user){
abort(403, 'no user found');
}
$data = [
'month' => HTMLHelper::getMonth(session('business_user_filter_month')),
'year' => session('business_user_filter_year'),
'TreeCalcBot' => $TreeCalcBot,
'user' => $user,
];
return view('admin.business.user_detail', $data);
}
private function setFilterVars(){
if(!session('business_user_filter_month')){
session(['business_user_filter_month' => intval(date('m'))]);
}
if(!session('business_user_filter_year')){
session(['business_user_filter_year' => intval(date('Y'))]);
}
if(!session('business_user_filter_active')){
session(['business_user_filter_active' => 1]);
}
if(Request::get('business_user_filter_name')){
session(['business_user_filter_name' => Request::get('business_user_filter_name')]);
}
if(Request::get('business_user_filter_active')){
session(['business_user_filter_active' => Request::get('business_user_filter_active')]);
}
if(Request::get('business_user_filter_month')){
session(['business_user_filter_month' => Request::get('business_user_filter_month')]);
}
if(Request::get('business_user_filter_year')){
session(['business_user_filter_year' => Request::get('business_user_filter_year')]);
}
}
private function initSearch($archive = false, $request = true)
{
$this->setFilterVars();
$this->month = Request::get('business_user_filter_month');
$this->year = Request::get('business_user_filter_year');
$query = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.payment_account', "!=", null);
if(Request::get('business_user_filter_active')){
if(Request::get('business_user_filter_active') == 1){
$query->where('users.payment_account', ">=", now());
}
if(Request::get('business_user_filter_active') == 2){
$query->where('users.payment_account', "<", now());
}
if(Request::get('business_user_filter_active') == 3){
//both -> payment_account only not null
}
}
if(Request::get('business_user_filter_name')){
//$query->where('users.account.first_name', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.account.last_name', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.account.m_account', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.email', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
}
//->orderBy('created_at', 'DESC');
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
})*/
return $query;
}
public function userDatatable()
{
$query = $this->initSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (User $user) {
return '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$user->id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>';
//<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-calculator"></span></a>
})
->addColumn('user_level', function (User $user) {
return $user->user_level ? $user->user_level->name : '';
})
->addColumn('active_account', function (User $user) {
return get_active_badge($user->isActiveAccount());
})
->addColumn('payment_account_date', function (User $user) {
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
})
->addColumn('sales_volume_points', function (User $user) {
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop').'</span>';
})
->addColumn('sales_volume_total', function (User $user) {
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop').'</span>';
})
->addColumn('sponsor', function (User $user) {
if($user->user_sponsor){
$sponsor = "";
if($user->user_sponsor->account){
$sponsor .= $user->user_sponsor->account->first_name." ".$user->user_sponsor->account->last_name;
$sponsor .= " &nbsp;".'<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$user->user_sponsor->id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button><br>';
}
$sponsor .= '<span class="small no-line-break">'.$user->email;
if($user->user_sponsor->account){
$sponsor .= ' | '.$user->user_sponsor->account->m_account;
}
$sponsor .= '</span>';
return $sponsor;
}
return '-';
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop').'</span>';
})
->addColumn('is_qual_kp', function (User $user) {
if($user->user_level){
$qual_kp = $user->user_level->qual_kp;
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum');
$isQualKP = ($sales_volume_points_sum >= $qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KD '.$qual_kp.'</span>';
}
return '-';
})
/* ->addColumn('sales_volume_points', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points');
})
->addColumn('sales_volume_points_shop', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop');
})
->addColumn('sales_volume_points_sum', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum');
})
->addColumn('sales_volume_total', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total');
})
->addColumn('sales_volume_total_shop', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop');
})
->addColumn('sales_volume_total_sum', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum');
})*/
->orderColumn('id', 'id $1')
->orderColumn('m_account', 'm_account $1')
->orderColumn('first_name', 'first_name $1')
->orderColumn('last_name', 'last_name $1')
->orderColumn('user_level', 'm_level $1')
->orderColumn('active_account', 'payment_account $1')
->rawColumns(['id', 'is_qual_kp', 'confirmed', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active', 'active_account'])
->make(true);
}
}

View file

@ -122,6 +122,21 @@ class LeadController extends Controller
$data = Request::all();
$show = Request::get('show');
if(isset($data['reverse_charge_validate']) && isset($data['user_id'])){
$user = User::findOrFail($data['user_id']);
$user->wizard = 1;
$user->save();
$userRepo = new UserRepository($user);
return $userRepo->reverse_charge_validate($data, $user);
}
if(isset($data['reverse_charge_delete']) && isset($data['user_id'])){
$user = User::findOrFail($data['user_id']);
$user->wizard = 1;
$user->save();
$userRepo = new UserRepository($user);
return $userRepo->reverse_charge_delete($data, $user);
}
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
$rules = array(
@ -158,9 +173,8 @@ class LeadController extends Controller
if(isset($data['m_account']) && $data['m_account']){
$user = User::findOrFail($data['user_id']);
$rules['m_account'] = 'unique:user_accounts,m_account,'.$user->account->id.',id';
}
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {

View file

@ -132,7 +132,7 @@ class MembershipController extends Controller
$image = $product->images->first()->slug;
}
$qty = Request::get('qty') ? Request::get('qty') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -2,14 +2,17 @@
namespace App\Http\Controllers;
use App\Models\Homeparty;
use App\Models\HomepartyUser;
use App\Models\Product;
use App\Models\ShoppingOrder;
use App\Models\ShoppingUser;
use App\User;
use Request;
use App\User;
use App\Models\Product;
use App\Models\Homeparty;
use App\Models\UserLevel;
use App\Models\ShoppingUser;
use App\Services\HTMLHelper;
use App\Models\HomepartyUser;
use App\Models\ShoppingOrder;
use App\Services\BusinessPlan\TreeCalcBot;
class ModalController extends Controller
{
@ -61,23 +64,49 @@ class ModalController extends Controller
/* $product = Product::find($data['id']); //current user form order
$ret = view("admin.modal.show_product", compact('product', 'data'))->render(); */
}
if($data['action'] === 'homeparty-add-product') {
$homeparty = Homeparty::find($data['id']);
$homeparty_user = HomepartyUser::find($data['user_id']);
$data['homeparty'] = $homeparty;
$ret = view("user.homeparty.modal_show_products", compact( 'data', 'homeparty', 'homeparty_user'))->render();
}
if($data['action'] === 'user-level-edit'){
$value = UserLevel::find($data['id']);
$route = route('admin_level_store', [$value->id]);
$ret = view("admin.modal.user_level_edit", compact('value', 'data', 'route'))->render();
}
if($data['action'] === 'business-user-detail'){
$user = User::findOrFail($data['id']);
if($data['init_from'] === 'admin'){
$data['month'] = session('business_user_filter_month');
$data['year'] = session('business_user_filter_year');
}else{
$data['month'] = session('team_user_filter_month');
$data['year'] = session('team_user_filter_year');
}
$TreeCalcBot = $this->getForBusinessUserDetail($user, $data);
$route = "";
$ret = view("admin.modal.business_user_detail", compact('TreeCalcBot', 'user', 'data'))->render();
}
}
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
}
private function getForBusinessUserDetail(User $user, $data){
$auth_user = \Auth::user();
if($auth_user->isAdmin() || $auth_user->id === $user->id){
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], $data['init_from']);
$TreeCalcBot->initDetailUser($user);
if(!$TreeCalcBot->user){
abort(403, 'no user found');
}
return $TreeCalcBot;
}
return null;
}
}

View file

@ -6,6 +6,7 @@ use Carbon;
use Request;
use App\Services\Payment;
use App\Models\UserInvoice;
use App\Services\HTMLHelper;
class PaymentInvoiceController extends Controller
{
@ -25,8 +26,8 @@ class PaymentInvoiceController extends Controller
$this->setFilterVars();
$data = [
'filter_months' => UserInvoice::$monthNames,
'filter_years' => UserInvoice::getYearRange(),
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(),
];
return view('admin.payment.invoice', $data);
}

View file

@ -0,0 +1,87 @@
<?php
namespace App\Http\Controllers\SyS;
use Carbon;
use Request;
use App\Services\SyS\Sales;
use App\Services\SyS\Import;
use App\Services\SyS\Cronjobs;
use App\Services\SyS\Customers;
use App\Services\SyS\DomainSSL;
use App\Http\Controllers\Controller;
use App\Services\SyS\Correction;
use App\Services\SyS\ShoppingOrders;
class SysController extends Controller
{
protected $userRepo;
public function __construct()
{
$this->middleware('sysadmin');
}
public function index()
{
return view('sys.index');
}
public function tool($serve)
{
switch ($serve) {
case 'sales_members':
return Sales::show();
break;
case 'customers':
return Customers::show();
break;
case 'cronjobs':
return Cronjobs::show();
break;
case 'domainssl':
return DomainSSL::show();
break;
case 'shopping_orders':
return ShoppingOrders::show();
break;
case 'import':
return Import::show();
break;
case 'corrections':
return Correction::show();
break;
}
abort(403, 'not found tool');
}
public function store($serve)
{
switch ($serve) {
case 'sales_members':
return Sales::show();
break;
case 'customers':
return Customers::store();
break;
case 'cronjobs':
return Cronjobs::store();
break;
case 'domainssl':
return DomainSSL::store();
break;
case 'shopping_orders':
return ShoppingOrders::store();
break;
case 'import':
return Import::store();
break;
case 'corrections':
return Correction::store();
break;
}
abort(403, 'not found tool');
}
}

View file

@ -1,374 +0,0 @@
<?php
namespace App\Http\Controllers\SyS;
use Auth;
use Request;
use App\User;
use App\Mail\MailInfo;
use App\Services\Shop;
use App\Models\UserShop;
use App\Models\Homeparty;
use App\Models\ShoppingUser;
use App\Models\PaymentMethod;
use App\Models\ShoppingOrder;
use App\Models\ShoppingOrderItem;
use App\Services\CustomerPriority;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Mail;
use App\Http\Controllers\Api\KasController;
use App\Repositories\ContractPDFRepository;
use App\Http\Controllers\Api\KasSLLController;
class AdminToolsController extends Controller
{
protected $userRepo;
public function __construct()
{
$this->middleware('sysadmin');
}
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
dd('index');
}
public function customers()
{
$shopping_users = ShoppingUser::where('member_id', '=', NULL)->where('auth_user_id', '=', NULL)->get();
$data = [
'values' => $shopping_users,
'text' => '',
];
return view('sys.admin.customers', $data);
}
public function customerStore()
{
$data = Request::all();
$ret = "";
if($data['action'] === 'makePaymentMethodsDefault'){
$users = User::where('payment_methods', '=', NULL)->get();
//$users = User::all();
foreach ($users as $user){
$user->payment_methods = PaymentMethod::getDefaultAsArray();
$user->save();
}
}
if($data['action'] === 'checkForAll'){
$shopping_users = CustomerPriority::checkForAll();
}
if($data['action'] === 'checkContractPDF'){
//create PDF
$user = User::findOrFail(80);
$pdf = new ContractPDFRepository($user);
$pdf->_set('disk', 'user');
$pdf->_set('dir', '/'.$user->id.'/documents/');
$pdf->_set('user_id', $user->id);
$pdf->_set('identifier', 'contract');
$pdf->createContractPDF();
}
if(strpos($data['action'], 'checkOne_') !== false){
$id = (int) str_replace('checkOne_', '', $data['action']);
$shopping_user = ShoppingUser::findOrFail($id);
$ret = CustomerPriority::checkOne($shopping_user);
}
\Session()->flash('alert-success', $ret);
return back();
}
public function points()
{
$c = 0;
if(false){ //8
dump("make homeparty tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('payment_for', '=', NULL)->get();
foreach($ShoppingOrders as $ShoppingOrder){
dump($ShoppingOrder->id);
dump($ShoppingOrder->shopping_user->getOrderPaymentFor());
$ShoppingOrder->payment_for = $ShoppingOrder->shopping_user->getOrderPaymentFor();
$ShoppingOrder->save();
$c ++;
}
dd($c);
}
if(false){ //8
dump("make homeparty tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeHomepartyTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //7
dump("make homeparty shipping_tax in homeparty order user_cart");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
if(isset($ShoppingOrder->homeparty->order['user_carts'])){
$user_carts = [];
foreach($ShoppingOrder->homeparty->order['user_carts'] as $id => $values){
$values['shipping_tax'] = round($values['shipping_price'] - $values['shipping_price_net'], 2);
dump($values['shipping_tax']);
$user_carts[$id] = $values;
}
$order = $ShoppingOrder->homeparty->order;
$order['user_carts'] = $user_carts;
$ShoppingOrder->homeparty->order = $order;
$ShoppingOrder->homeparty->save();
}
$c ++;
}
dd($c);
}
if(false){ //6
dump("make tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //5
//run after make points etc.
dump("correction shopping_order homeparty");
//dd('check point function');
$ShoppingOrders = ShoppingOrder::where('payment_for', 5)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$homeparty = Homeparty::find($ShoppingOrder->homeparty_id);
if($homeparty && $homeparty->completed && $homeparty->step > 10){
$ShoppingOrder->subtotal = $homeparty->order['ek_price_net'];
$ShoppingOrder->subtotal_ws = 0;
$ShoppingOrder->tax = $ShoppingOrder->total - $homeparty->order['ek_price_net'];
$ShoppingOrder->points = $homeparty->order['points'] - $homeparty->order['bonus_points_diff'];
$ShoppingOrder->save();
$c ++;
}
}
dd($c);
}
if(false){ //4
dump("make tax in ShoppingOrderItem");
dd('check point function');
$ShoppingOrderItems = ShoppingOrderItem::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->tax = $item->price - $item->price_net;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //3
dump("make price_net in ShoppingOrderItem");
dd('check point function');
$ShoppingOrderItems = ShoppingOrderItem::where('price_net', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->price_net = $item->price / (100 + $item->tax_rate) * 100;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //2
dump("add payment_for in shopping_order");
dd('check point function');
$ShoppingUsers = ShoppingUser::all();
foreach($ShoppingUsers as $ShoppingUser){
if($ShoppingUser->shopping_order){
$ShoppingUser->shopping_order->payment_for = $ShoppingUser->getOrderPaymentFor();
$ShoppingUser->shopping_order->save();
$c ++;
}
}
dd($c);
}
if(false){ //1
dump("make points in shopping_order_item and total in ShoppingOrder");
dd('check point function');
$ShoppingOrders = ShoppingOrder::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$points_total = 0;
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
$points = $shopping_order_item->product ? $shopping_order_item->product->points : 0;
$points_total += $points;
$shopping_order_item->points = $points;
$shopping_order_item->save();
$c ++;
}
$ShoppingOrder->points = $points_total;
$ShoppingOrder->save();
}
dd($c);
}
}
public function cronjobs()
{
//$user_shops = UserShop::all();
$text = "";
$values = [
'check_payments_account' => route('cron_jobs_action', ['check_payments_account', 'key'])
];
$data = [
'values' => $values,
'text' => $text,
];
return view('sys.admin.cronjobs', $data);
}
public function cronjobsStore()
{
$data = Request::all();
\Session()->flash('alert-save', true);
return back();
}
public function domainSSL()
{
$user_shops = UserShop::all();
$text = "";
/* $kas = new KasController();
$domain = 'mivita.care';
$ssl = KasSLLController::getApiSSLParameter();
$subdomains = $kas->action('get_subdomains');
foreach ($subdomains as $subdomain){
/*if($subdomain['subdomain_name'] === 'bio-aloe.mivita.care'){
dump($subdomain);
}
if($subdomain['subdomain_name'] === 'rockmyworld-by-conny.mivita.care'){
dd($subdomain);
}*/
/*
$text .= $subdomain['subdomain_name']." - ".$subdomain['ssl_certificate_sni']." - ";
if($subdomain['ssl_certificate_sni'] !== "Y"){
$pra = array(
'hostname' => $subdomain['subdomain_name'],
);
$pra = array_merge($pra, $ssl);
$value = $kas->action('update_ssl', $pra);
$text .= $value;
}else{
if(isset($subdomain['ssl_certificate_sni_is_active'])){
$text .= $subdomain['ssl_certificate_sni_is_active'].'-is_active';
}else{
$text .= '-CHECK!';
}
}
$text .= "\n";
}*/
$data = [
'values' => $user_shops,
'text' => $text,
];
return view('sys.admin.domain-ssl', $data);
}
public function domainSSLStore()
{
$data = Request::all();
\Session()->flash('alert-save', true);
return back();
}
public function shoppingOrders()
{
$shopping_users = ShoppingUser::all();
$data = [
'values' => $shopping_users,
'text' => '',
];
return view('sys.admin.shopping-orders', $data);
}
public function shoppingOrdersStore()
{
//first run
$data = Request::all();
if($data['action'] === 'first_run'){
$shopping_users = ShoppingUser::whereHas('shopping_order', function($q) {
$q->where('txaction', 'paid')->OrWhere('txaction', 'appointed');
})->get();
$order_email = [];
$order_number = [];
foreach ($shopping_users as $shopping_user){
$order_email[$shopping_user->billing_email] = isset($order_email[$shopping_user->billing_email]) ? $order_email[$shopping_user->billing_email] + 1 : 1;
if($shopping_user->number) {
$order_number[$shopping_user->number] = isset($order_number[$shopping_user->number]) ? $order_number[$shopping_user->number] + 1 : 1;
$shopping_user->orders = $order_number[$shopping_user->number];
}else {
$shopping_user->orders = $order_email[$shopping_user->billing_email];
}
$shopping_user->save();
}
\Session()->flash('alert-save', true);
}
if($data['action'] === 'next_run'){
Shop::userOrders();
\Session()->flash('alert-save', true);
}
return back();
}
}

View file

@ -1,54 +0,0 @@
<?php
namespace App\Http\Controllers\SyS;
use App\Http\Controllers\Controller;
use App\Repositories\ImportRepository;
use Request;
class ImportController extends Controller
{
protected $userRepo;
protected $import;
public function __construct(ImportRepository $import)
{
$this->middleware('sysadmin');
$this->import = $import;
}
public function import()
{
$data = [
];
return view('sys.admin.import', $data);
}
public function importStore()
{
$input = Request::all();
return $this->import->upload($input);
}
public function importShow($type, $file, $skip = 0, $limit = 4000)
{
$import = $this->import->read($type, $file, $skip, $limit);
$data = [
'limit' => $limit,
'type' => $type,
'file' => $file,
'import' => $import,
'skip' => $skip,
];
return view('sys.admin.import-show', $data);
}
}

View file

@ -378,7 +378,7 @@ class OrderController extends Controller
}
//get the card item
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
if(isset($data['qty']) && $data['qty'] > 0){

View file

@ -2,8 +2,12 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\User;
use App\Services\HTMLHelper;
use App\Http\Controllers\Controller;
use App\Services\BusinessPlan\TreeCalcBot;
use Request;
class TeamController extends Controller
@ -28,4 +32,40 @@ class TeamController extends Controller
];
return view('user.team.members', $data);
}
public function structure()
{
$user = User::find(\Auth::user()->id);
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('team_user_filter_month'), session('team_user_filter_year'), 'member');
$TreeCalcBot->initUser($user->id);
//for testing
//$TreeCalcBot->initUser(56);
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(2022),
'TreeCalcBot' => $TreeCalcBot,
];
return view('user.team.structure', $data);
}
private function setFilterVars(){
if(!session('team_user_filter_month')){
session(['team_user_filter_month' => intval(date('m'))]);
}
if(!session('team_user_filter_year')){
session(['team_user_filter_year' => intval(date('Y'))]);
}
if(Request::get('team_user_filter_month')){
session(['team_user_filter_month' => Request::get('team_user_filter_month')]);
}
if(Request::get('team_user_filter_year')){
session(['team_user_filter_year' => Request::get('team_user_filter_year')]);
}
}
}

View file

@ -45,43 +45,14 @@ class UserDataController extends Controller
/*if(!$user->account){
$user->account = new UserAccount();
}*/
$data = Request::all();
if(isset($data['reverse_charge_validate'])){
return $this->userRepo->reverse_charge_validate($data, $user);
}
$rules = array(
'tax_identification_number' => 'required',
'reverse_charge' => 'required',
);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
$data = [
'user' => $user,
];
return view('user.edit', $data)->withErrors($validator);
}
$ret = $this->userRepo->reverse_charge_activate(Request::all(), $user);
if($ret === 'error'){
$validator = Validator::make(Request::all(), []);
$validator->errors()->add('tax_identification_number', __('Die UST-ID konnte nicht validiert werden, Eingabe bitte prüfen.'));
$data['reverse_charge'] = 0;
return redirect(route('user_edit'))->withErrors($validator)->withInput($data);
}
if($ret === 'valid'){
\Session()->flash('alert-success', 'UST-ID erfolgreich eingetragen.');
return redirect('/user/edit');
}
}
if(isset($data['reverse_charge_delete'])){
$user->account->tax_identification_number = '';
$user->account->reverse_charge = 0;
$user->account->reverse_charge_code = null;
$user->account->reverse_charge_valid = null;
$user->account->save();
\Session()->flash('alert-success', 'Reverse Charge Verfahren und UST-ID gelöscht.');
return redirect('/user/edit');
return $this->userRepo->reverse_charge_delete($data, $user);
}
$rules = array(

View file

@ -2,9 +2,6 @@
namespace App\Http\Controllers;
use App\Models\Attribute;
use App\Models\ProductAttribute;
use App\Models\UserLevel;
use Request;
@ -19,9 +16,8 @@ class UserLevelController extends Controller
public function index()
{
$data = [
'values' => UserLevel::all(),
'values' => UserLevel::orderBy('pos', 'asc')->get(),
'trans' => array_keys(config('localization.supportedLocales')),
];
return view('admin.level.index', $data);
@ -31,23 +27,27 @@ class UserLevelController extends Controller
{
$data = Request::all();
$data['active'] = isset($data['active']) ? true : false;
$data['default'] = isset($data['default']) ? true : false;
$data['next_id'] = (isset($data['next_id']) && $data['next_id'] != 0) ? $data['next_id'] : null;
//is true -> set all other of false;
if($data['default'] === true){
$values = UserLevel::all();
foreach ($values as $value) {
$value->default = false;
$value->save();
}
}
if($data['id'] == "new"){
$model = UserLevel::create([
'name' => $data['name'],
'pos' => $data['pos'],
'margin' => $data['margin'],
'active' => isset($data['active']) ? true : false,
]);
$model = UserLevel::create($data);
}else{
$model = UserLevel::find($data['id']);
$model->name = $data['name'];
$model->pos = $data['pos'];
$model->margin = $data['margin'];
$model->active = isset($data['active']) ? true : false;
$model->fill($data);
$model->save();
}
if(!empty($data['trans'])){
/*if(!empty($data['trans'])){
$trans = [];
foreach ($data['trans'] as $lang => $value){
if($value && $value != null){
@ -58,7 +58,7 @@ class UserLevelController extends Controller
$model->trans_name = $trans;
$model->save();
}
}
}*/
\Session()->flash('alert-save', '1');
return redirect(route('admin_levels'));

View file

@ -33,7 +33,7 @@ class CardController extends Controller
if($product->images->count()){
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -59,7 +59,7 @@ class CardController extends Controller
$image = $product->images->first()->slug;
}
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -110,19 +110,7 @@ class CheckoutController extends Controller
//$shopping_user->save();
}
if($is_from !== 'shopping' && Util::getAuthUser()){
$user = Util::getAuthUser();
$payment_methods = $user->payment_methods;
$payment_data = $user->account->payment_data;
}else{
$payment_methods = PaymentMethod::getDefaultAsArray()->toArray();
$payment_data = false;
}
$payment_methods_active = \App\Models\PaymentMethod::where('active', true)->get()->pluck( 'id', 'short')->toArray();
$payment_methods = $this->getPaymentsMethods($is_from);
$data = [
'is_from' => $is_from,
'is_for' => $is_for,
@ -130,13 +118,40 @@ class CheckoutController extends Controller
'user_shop' => Util::getUserShop(),
'shopping_user' => $shopping_user,
'shopping_mode' => Util::getUserShoppingMode(),
'payment_methods' => $payment_methods,
'payment_methods_active' => $payment_methods_active,
'payment_data' => $payment_data,
'payment_methods' => $payment_methods['default'],
'payment_methods_active' => $payment_methods['active'],
'payment_data' => $payment_methods['data'],
];
return view('web.templates.checkout', $data);
}
private function getPaymentsMethods($is_from){
$payment_methods = [];
if($is_from !== 'shopping' && Util::getAuthUser()){
$user = Util::getAuthUser();
$payment_methods['default'] = $user->payment_methods;
$payment_methods['data'] = $user->account->payment_data;
}else{
$payment_methods['default'] = PaymentMethod::getDefaultAsArray()->toArray();
$payment_methods['data'] = false;
}
$payment_methods['active'] = \App\Models\PaymentMethod::where('active', true)->get()->pluck( 'id', 'short')->toArray();
return $payment_methods;
}
private function isPaymentsMethodsActive($payment_method, $is_from){
$payment_names = ['wlt#PPE' => 'PP', 'cc' => 'CC', 'sb#PNT' => 'SB', 'elv' => 'SEPA', 'vor' => 'VOR', 'fnc#MIV' => 'FNC'];
$payment_methods = $this->getPaymentsMethods($is_from);
if(isset($payment_names[$payment_method])){
$payment_with = $payment_names[$payment_method];
if(array_key_exists($payment_with, $payment_methods['active']) && in_array($payment_methods['active'][$payment_with], $payment_methods['default'])){
return true;
}
}
abort(404);
}
private function shoppingUserAuthData($is_from, $is_for, $data = []){
$user = Util::getAuthUser();
@ -217,8 +232,11 @@ class CheckoutController extends Controller
public function checkoutFinal(){
$data = Request::all();
if(isset($data['payment_method'])){
$this->isPaymentsMethodsActive($data['payment_method'], $data['is_from']);
}
//change selected Country
if(isset($data['selected_country']) && $data['selected_country'] === 'change'){
if(!Request::get('same_as_billing')){
@ -541,7 +559,7 @@ class CheckoutController extends Controller
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug,
];
@ -572,7 +590,7 @@ class CheckoutController extends Controller
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];

View file

@ -3,17 +3,18 @@
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Mail\MailContact;
use App\Mail\MailVerifyAccount;
use App\Repositories\UserRepository;
use App\Services\UserService;
use App\User;
use GuzzleHttp\Client;
use Request;
use Illuminate\Support\Facades\Mail;
use App\Services\Util;
use App\User;
use Validator;
use App\Services\Util;
use GuzzleHttp\Client;
use App\Mail\MailContact;
use App\Models\UserLevel;
use App\Services\UserService;
use App\Mail\MailVerifyAccount;
use App\Http\Controllers\Controller;
use App\Repositories\UserRepository;
use Illuminate\Support\Facades\Mail;
class RegisterController extends Controller
@ -104,7 +105,15 @@ class RegisterController extends Controller
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
$user->confirmation_code_remider = 0;
$user->m_sponsor = $m_sponsor_id;
$user->m_level = 1;
$UserLevel = UserLevel::where('default', 1)->first();
if($UserLevel){
$user->m_level = $UserLevel->id;
}else{
$user->m_level = 10;
}
$user->save();
$user->account->data_protection = now();

View file

@ -18,6 +18,7 @@ use App\Models\ShippingCountry;
use App\Mail\MailReleaseAccount;
use App\Models\ShoppingInstance;
use App\Repositories\FileRepository;
use App\Repositories\UserRepository;
use Illuminate\Support\Facades\Mail;
class WizardController extends Controller
@ -100,6 +101,10 @@ class WizardController extends Controller
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
];
if($step == 5){
if($user->active){
$user->active = false;
$user->save();
}
return view('user.wizard.register_release', $data);
}
@ -211,6 +216,22 @@ class WizardController extends Controller
return redirect(route('wizard_register'));
}
if ($step == 1) {
$data = Request::all();
if(isset($data['reverse_charge_validate'])){
$user->wizard = 1;
$user->save();
$userRepo = new UserRepository($user);
return $userRepo->reverse_charge_validate($data, $user);
}
if(isset($data['reverse_charge_delete'])){
$user->wizard = 1;
$user->save();
$userRepo = new UserRepository($user);
return $userRepo->reverse_charge_delete($data, $user);
}
$rules = array(
'salutation' => 'required',
'first_name' => 'required',
@ -241,7 +262,6 @@ class WizardController extends Controller
$user->save();
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Request::all());
}
$data = Request::all();
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
$user->account->fill($data)->save();
$user->wizard = 2;
@ -478,8 +498,7 @@ class WizardController extends Controller
if($product->images->count()){
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -494,7 +513,7 @@ class WizardController extends Controller
if($product_on_board->images->count()){
$image = $product_on_board->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points]);
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points, 'no_commission' => $product_on_board->no_commission]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -59,7 +59,6 @@ class Checkout
if(\Session::has('user_shop') && \Session::has('isCheckout') && Yard::instance('shopping')->count()){
return $next($request);
}
return redirect(config('app.url'));
}

View file

@ -30,7 +30,10 @@ class Subdomain
if(!$user_shop->active){
abort(503);
}
if(!$user_shop->user && !$user_shop->user->isActiveShop()){
if(!$user_shop->user){
abort(503);
}
if(!$user_shop->user->isActiveShop()){
abort(503);
}
\Session::put('user_shop', $user_shop);
@ -52,7 +55,7 @@ class Subdomain
return $next($request);
}
}
return redirect(config('app.url') .$tld);
return redirect(config('app.url'));
}
}

View file

@ -206,12 +206,6 @@ class UserInvoiceCredit extends Model
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
}
public static function getYearRange()
{
$start = 2021;
$end = date("Y");
return array_reverse(range($start, $end));
}
public static function getMonthName($month)
{

View file

@ -163,6 +163,7 @@ class Product extends Model
'contents_total',
'unit',
'number',
'ean',
'wp_number',
'icons',
'description',
@ -183,8 +184,8 @@ class Product extends Model
'' => '-',
'show_upgrade' => 'Kann geupdatet werden',
'show_order' => 'Wird immer als Option angezeigt',
'upgrade' => 'Produktupgrade zur Produkt ID',
'upgrade_member' => 'Beraterupgrade zur Karriere ID',
'upgrade_product' => 'Produkt upgrade zur Produkt ID',
'upgrade_member' => 'Berater upgrade zur Karriere ID',
'proportional_voucher' => 'Anteiliger Gutschein Berater',
];
public $unitTypes = [
@ -224,6 +225,14 @@ class Product extends Model
];
public $actionNames = [
0 => 'Zahlung für Mitgliedschaft',
1 => 'Zahlung für Mitgliedschaft + Shop',
2 => 'Bei Zahlung Shop upgrade auf ID',
4 => 'Bei Zahlung Karriere upgrade auf ID',
];
public function sluggable()
{
return [
@ -249,6 +258,17 @@ class Product extends Model
return $this->hasMany('App\Models\ProductImage', 'product_id', 'id')->where('active', true)->orderBy('pos');
}
public function getImageUrl(){
if(count($this->imagesActive)){
return route('product_image', [$this->imagesActive->first()->slug]);
}
return "";
}
public function getProductUrl(){
return 'https://mivita.shop/produkte/alle-produkte/'.$this->slug;
}
public function country_prices()
{
return $this->hasMany(CountryPrice::class, 'product_id');
@ -267,13 +287,26 @@ class Product extends Model
return $this->hasMany(ProductIngredient::class, 'product_ingredients', 'id');
}
public function getActionName($id = 0){
if(isset($this->actions[$id])){
return $this->actions[$id];
}
return false;
}
public function getUpgradeToIdName($from){
if($from === 'payment_for_shop_upgrade'){
$value = Product::find($this->upgrade_to_id);
}
if($from === 'payment_for_lead_upgrade'){
$value = UserLevel::find($this->upgrade_to_id);
}
if($value){
return $value->name;
}
return "not found";
}
public function _format_number($value){
return preg_replace("/[^0-9,]/", "", $value);
}

View file

@ -85,6 +85,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read \App\Models\Homeparty|null $homeparty
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereHomepartyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
* @property array|null $tax_split
* @property-read \App\Models\UserInvoice|null $user_invoice
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserSalesVolume[] $user_sales_volume
* @property-read int|null $user_sales_volume_count
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereTaxSplit($value)
*/
class ShoppingOrder extends Model
{
@ -265,6 +270,19 @@ class ShoppingOrder extends Model
return "";
}
public function getLastShoppingPaymentTransaction(){
if($this->shopping_payments){
$shopping_payment = $this->shopping_payments->last();
if($shopping_payment){
$payt = $shopping_payment->payment_transactions->last();
if($payt){
return $payt;
}
}
}
return false;
}
public function getShippedType(){
return isset(self::$shippedTypes[$this->shipped]) ? self::$shippedTypes[$this->shipped] : "";
}

View file

@ -48,6 +48,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $homeparty_id
* @property-read \App\Models\Homeparty|null $homeparty
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereHomepartyId($value)
* @property string|null $tax
* @property string|null $price_vk_net
* @property string|null $discount
* @property int|null $points
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereDiscount($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem wherePoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem wherePriceVkNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereTax($value)
*/
class ShoppingOrderItem extends Model
{

View file

@ -133,7 +133,7 @@ class UserAccount extends Model
'm_account', 'm_salutation', 'm_first_name', 'm_last_name', 'm_notes', 'company', 'salutation', 'first_name', 'last_name', 'address', 'address_2', 'zipcode', 'city', 'country_id', 'pre_phone_id', 'phone', 'pre_mobil_id', 'mobil',
'tax_number', 'tax_identification_number', 'taxable_sales', 'same_as_billing',
'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_country_id', 'shipping_pre_phone_id', 'shipping_phone',
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram', 'notice'
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram', 'bank_owner', 'bank_iban', 'bank_bic', 'notice'
];
//'reverse_charge', 'reverse_charge_valid'

View file

@ -31,10 +31,42 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
*
* @property ShoppingOrder $shopping_order
*
* @package App\Models
* @property string|null $filename
* @property string|null $dir
* @property string|null $delivery_filename
* @property string|null $delivery_dir
* @property string|null $disk
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice newQuery()
* @method static \Illuminate\Database\Query\Builder|UserInvoice onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice query()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereCancellation($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereCancellationDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereCancellationId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDeliveryDir($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDeliveryFilename($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDir($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereDisk($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereFilename($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereFullNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereInfos($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice wherePaid($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice wherePaidDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereShoppingOrderId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoice whereYear($value)
* @method static \Illuminate\Database\Query\Builder|UserInvoice withTrashed()
* @method static \Illuminate\Database\Query\Builder|UserInvoice withoutTrashed()
* @mixin \Eloquent
*/
class UserInvoice extends Model
{
@ -147,13 +179,6 @@ class UserInvoice extends Model
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
}
public static function getYearRange()
{
$start = 2021;
$end = date("Y");
return array_reverse(range($start, $end));
}
public static function getMonthName($month)
{
return isset(self::$monthNames[$month]) ? self::$monthNames[$month] : $month;

View file

@ -2,7 +2,9 @@
namespace App\Models;
use App\Services\Util;
use Illuminate\Database\Eloquent\Model;
use App\Models\UserLevel as ModelsUserLevel;
/**
* App\Models\UserLevel
@ -13,12 +15,14 @@ use Illuminate\Database\Eloquent\Model;
* @property float|null $margin
* @property int|null $pos
* @property int $active
* @property int $default
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereDefault($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereMargin($value)
@ -27,6 +31,29 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereTransName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereUpdatedAt($value)
* @mixin \Eloquent
* @property int|null $next_id
* @property int|null $margin_shop
* @property int|null $qual_kp
* @property int|null $qual_tp
* @property string|null $growth_bonus
* @property int|null $pr_line_1
* @property int|null $pr_line_2
* @property int|null $pr_line_3
* @property int|null $pr_line_4
* @property int|null $pr_line_5
* @property int|null $pr_line_6
* @property-read UserLevel|null $next_user_level
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereGrowthBonus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereMarginShop($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereNextId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine1($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine2($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine3($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine4($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine5($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePrLine6($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereQualKp($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereQualTp($value)
*/
class UserLevel extends Model
{
@ -35,42 +62,41 @@ class UserLevel extends Model
protected $casts = ['trans_name' => 'array'];
protected $fillable = [
'name', 'margin', 'pos', 'active',
'next_id', 'name', 'margin', 'margin_shop', 'qual_kp', 'qual_tp', 'growth_bonus', 'pr_line_1', 'pr_line_2', 'pr_line_3', 'pr_line_4', 'pr_line_5', 'pr_line_6', 'pos', 'active', 'default',
];
/* public function childrens()
public function next_user_level()
{
return $this->hasMany('App\Models\Attribute', 'parent_id', 'id');
return $this->belongsTo('App\Models\UserLevel', 'next_id', 'id');
}
public function getNextUserLevels(){
//$ret = [0=>'Keinen'];
$ret = UserLevel::where('active', true)->where('id', '!=', $this->id)->orderBy('pos', 'asc')->get()->pluck('name', 'id')->toArray();
return array_add($ret, 0, '-> Keinen Karriere Level');
}
*/
public function setPosAttribute($value){
$this->attributes['pos'] = is_numeric($value) ? $value : null;
}
public function _format_number($value){
return preg_replace("/[^0-9,]/", "", $value);
public function setGrowthBonusAttribute($value)
{
$this->attributes['growth_bonus'] = $value !== null ? Util::reFormatNumber($value) : null;
}
public function setMarginAttribute( $value ) {
$value = $this->_format_number($value);
$this->attributes['margin'] = floatval(str_replace(',', '.', $value));
public function getFormattedGrowthBonus()
{
return isset($this->attributes['growth_bonus']) ? Util::formatNumber($this->attributes['growth_bonus'],1) : "";
}
public function getFormattedMargin()
{
if(!isset($this->attributes['margin'])){
return "";
}
if(\App::getLocale() === "en"){
return number_format($this->attributes['margin'], 2, '.', ',');
}
return number_format($this->attributes['margin'], 2, ',', '.');
return isset($this->attributes['margin']) ? $this->attributes['margin'] : "";
}
public function getLang($key)
{
$lang = \App::getLocale();

View file

@ -9,6 +9,7 @@ namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use App\Models\ShoppingOrder;
use App\User;
/**
* Class UserSalesVolume
@ -27,11 +28,34 @@ use App\Models\ShoppingOrder;
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property ShoppingOrder|null $shopping_order
* @property User $user
*
* @package App\Models
* @property int|null $user_invoice_id
* @property int|null $month_shop_points
* @property float|null $month_shop_total_net
* @property-read \App\Models\UserInvoice|null $user_invoice
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume query()
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthPoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthShopPoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthShopTotalNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthTotalNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume wherePoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereShoppingOrderId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereTotalNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereUserInvoiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereYear($value)
* @mixin \Eloquent
*/
class UserSalesVolume extends Model
{

View file

@ -2,13 +2,14 @@
namespace App\Repositories;
use App\Libraries\InvoicePDF;
use PDF;
use Storage;
use App\Services\Invoice;
use App\Models\UserInvoice;
use App\Libraries\InvoicePDF;
use App\Models\ShoppingOrder;
use App\Services\MyPDFMerger;
use App\Services\UserService;
use App\Models\UserSalesVolume;
class InvoiceRepository extends BaseRepository {
@ -32,7 +33,10 @@ class InvoiceRepository extends BaseRepository {
{
//need invoice $data
$number = Invoice::getInvoiceNumber();
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $this->model->created_at->format("d.m.Y");
if($payt = $this->model->getLastShoppingPaymentTransaction()){
$invoice_date = $payt->created_at->format("d.m.Y");
}
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $invoice_date;
$invoice_send_mail = isset($request['invoice_send_mail']) ? false : true;
$this->invoice_number = Invoice::createInvoiceNumber($number, $this->invoice_date);
$this->dir = Invoice::getInvoiceStorageDir($this->invoice_date);
@ -100,6 +104,7 @@ class InvoiceRepository extends BaseRepository {
}
private function makePDF(){
$data = [
'shopping_order' => $this->model,
'invoice_date' => $this->invoice_date,
@ -107,6 +112,11 @@ class InvoiceRepository extends BaseRepository {
'user_sales_volume' => $this->user_sales_volume,
];
if($this->model->auth_user_id){
UserService::checkUserTaxShippingCountry($this->model->auth_user, $this->model->country_id);
$data = array_merge($data, UserService::getYardInfo());
}
if(!Storage::disk('public')->exists( $this->dir )){
Storage::disk('public')->makeDirectory($this->dir); //creates directory
}
@ -144,8 +154,10 @@ class InvoiceRepository extends BaseRepository {
*/
$status = UserSalesVolume::getStatusByOrder($this->model);
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
//akuteller tag / Monat.
$month = date('m');
$year = date('Y');
$date = date('d.m.Y');
if($status === 3){ //shop bestellung User pending
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
@ -175,7 +187,7 @@ class InvoiceRepository extends BaseRepository {
'shopping_order_id' => $this->model->id,
'month' => $month,
'year' => $year,
'date' => date('d.m.Y'),
'date' => $date,
'points' => $this->model->points,
'month_points' => $month_points,
'month_shop_points' => $month_shop_points,

View file

@ -2,12 +2,14 @@
namespace App\Repositories;
use App\Models\PaymentMethod;
use App\Models\UserAccount;
use App\User;
use App\Models\UserAccount;
use App\Models\PaymentMethod;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Api\KasController;
use Util;
use Validator;
use Request;
class UserRepository extends BaseRepository {
@ -17,8 +19,6 @@ class UserRepository extends BaseRepository {
$this->model = $model;
}
public function update($data)
{
@ -74,6 +74,86 @@ class UserRepository extends BaseRepository {
return $this->model;
}
public function deleteUser(User $user)
{
if($user->account){
$user->account->delete();
}
if($user->shop){
$subdomain_name = $user->shop->slug.'.mivita.care';
$user->shop->name = "delete".$user->shop->id;
$user->shop->slug = "delete".$user->shop->id;
$user->shop->save();
$user->shop->delete();
//isset KAS - delete Subdomain
if(!Util::isTestSystem()){
$kas = new KasController();
$pra = array(
'subdomain_name' => $subdomain_name,
);
$kas->action('delete_subdomain', $pra);
}
}
$user->email = "delete".time();
$user->password = "delete".time();
$user->confirmed = 0;
$user->confirmation_code = "delete".time();
$user->confirmation_date = null;
$user->confirmation_code_to = null;
$user->confirmation_code_remider = 2;
$user->agreement = null;
$user->active = 0;
$user->remember_token = '';
$user->active_date = null;
$user->admin = 0;
$user->deleted_at = now();
$user->save();
return true;
}
public function reverse_charge_validate($data, $user){
if(isset($data['reverse_charge_validate'])){
$rules = array(
'tax_identification_number' => 'required',
'reverse_charge' => 'required',
);
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
$data = [
'user' => $user,
];
return view('user.edit', $data)->withErrors($validator);
}
$ret = $this->reverse_charge_activate($data, $user);
if($ret === 'error'){
$validator = Validator::make($data, []);
$validator->errors()->add('tax_identification_number', __('Die UST-ID konnte nicht validiert werden, Eingabe bitte prüfen.'));
$data['reverse_charge'] = 0;
return redirect(route('user_edit'))->withErrors($validator)->withInput($data);
}
if($ret === 'valid'){
\Session()->flash('alert-success', 'UST-ID erfolgreich eingetragen.');
return redirect('/user/edit');
}
}
}
public function reverse_charge_delete($data, $user){
if(isset($data['reverse_charge_delete'])){
$user->account->tax_identification_number = '';
$user->account->reverse_charge = 0;
$user->account->reverse_charge_code = null;
$user->account->reverse_charge_valid = null;
$user->account->save();
\Session()->flash('alert-success', 'Reverse Charge Verfahren und UST-ID gelöscht.');
return redirect('/user/edit');
}
}
public function reverse_charge_activate($data, $user){
/* 'AT' => 'AT-Oesterreich',
@ -144,28 +224,4 @@ class UserRepository extends BaseRepository {
}
public function deleteUser(User $user)
{
if($user->account){
$user->account->delete();
}
$user->email = "delete".time();
$user->password = "delete".time();
$user->confirmed = 0;
$user->confirmation_code = "delete".time();
$user->confirmation_date = null;
$user->confirmation_code_to = null;
$user->confirmation_code_remider = 2;
$user->agreement = null;
$user->active = 0;
$user->remember_token = '';
$user->active_date = null;
$user->admin = 0;
$user->deleted_at = now();
$user->save();
return true;
}
}

View file

@ -0,0 +1,299 @@
<?php
namespace App\Services\BusinessPlan;
use App\Models\UserLevel;
use App\User;
use stdClass;
class TreeCalcBot
{
private $items = [];
private $parentless = [];
private $sponsor;
private $date;
public $user;
public $lines = [];
public $total_tp = 0;
public $total_qual_tp = 0;
public $commission_total = 0;
public $qual_user_level = null;
private $init_from;
private static $userIDs = [];
public static function addUserID($id){
self::$userIDs[$id] = $id;
}
public function __construct($month, $year, $init_from = 'member')
{
$this->date = new stdClass();
$date = \Carbon::parse($year.'-'.$month.'-1');
$this->date->month = $month;
$this->date->year = $year;
$this->date->start_date = $date->format('Y-m-d H:i:s');
$this->date->end_date = $date->endOfMonth()->format('Y-m-d H:i:s');
$this->init_from = $init_from;
}
public function initMain()
{
$this->readMain();
$this->readParentsUser();
$this->readParentlessUser();
}
public function initUser($user_id)
{
$user = User::find($user_id);
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem;
$this->readParentsUser();
$this->readSponsorUser($user->m_sponsor);
}
public function initDetailUser($user)
{
$this->user = new TreeUserItem($this->date);
$this->user->makeUser($user);
$this->user->readParentsUser();
//calculate Lines
if(count($this->user->items) > 0){
$this->calcUserTP($this->user->items, 1);
}
$this->calcQualTP();
}
private function calcUserTP($items, $line){
if(!isset($this->lines[$line])){
$this->lines[$line] = new stdClass();
$this->lines[$line]->points = 0;
}
foreach($items as $item){
if(count($item->items) > 0){
$this->calcUserTP($item->items, $line+1);
}
$this->lines[$line]->points += $item->sales_volume_points_sum;
$this->total_tp += $item->sales_volume_points_sum;
}
}
public function getKeybyLine($line, $key){
if(!isset($this->lines[$line])){
return 0;
}
return isset($this->lines[$line]->{$key}) ? $this->lines[$line]->{$key} : 0;
}
public function calcQualTP(){
if($this->user->isQualKP()){
$this->total_qual_tp = $this->total_tp + $this->user->getRestQualKP();
$this->qual_user_level = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->orderBy('qual_tp', 'desc')->first();
$this->commission_total = 0;
if($this->qual_user_level){
foreach($this->lines as $line => $values){
$values->margin = $this->qual_user_level->{'pr_line_'.$line};
$values->commission = round($values->points / 100 * $values->margin, 2);
$this->commission_total += $values->commission;
$this->lines[$line] = $values;
}
}
}
}
private function readMain(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.m_sponsor', "=", null)
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
if($users){
foreach($users as $user){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem;
}
}
}
private function readParentsUser(){
foreach($this->items as $item){
$item->readParentsUser();
}
}
private function readParentlessUser(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
foreach($users as $user){
if(!isset(self::$userIDs[$user->id])){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->checkSponsor();
$this->parentless[] = $TreeUserItem;
}
}
}
public function readSponsorUser($m_sponsor_id){
$sponsor = User::find($m_sponsor_id);
if($sponsor){
$this->sponsor = new TreeUserItem($this->date);
$this->sponsor->makeUser($sponsor);
}
}
public function getItems(){
return $this->items;
}
public function makeHtmlTree(){
$deep = 0;
$ret = '<ol class="dd-list">';
foreach($this->items as $item){
$ret .= $this->addItem($item, $deep);
}
$ret .= '</ol>';
return $ret;
}
private function addItem($item, $deep){
$button = '';
if(($this->init_from === 'admin' && \Auth::user()->isAdmin()) || ($this->init_from === 'member' && \Auth::user()->id === $item->id)){
$button = ' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$item->id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="'.$this->init_from .'"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>';
}
return '<li class="dd-item dd-nodrag" data-id="'.$item->id.'">'.
'<div class="dd-handle">
<div class="media align-items-center">
<div class="d-flex flex-column justify-content-center align-items-center">
'.(($deep > 0) ? '<div class="text-large font-weight-bolder line-height-1 my-2 text-secondary badge badge-outline-secondary">'.$deep.'</div>' : '').'
</div>
<div class="media-body ml-2">
<span class="'.($item->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($item->active_account ? 'text-primary' : 'text-danger').'"></span>
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level.' | '.$item->m_account.'</span>
<br><span class="small">'.
($item->active_account ?
'<strong>Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong> | Umsatz: '.$item->sales_volume_total_sum.' €</strong> | B: '.$item->sales_volume_total.' € | S: '.$item->sales_volume_total_shop.' €'.
$button
:
'Account bis: '.$item->payment_account_date).
'</span>
</span>
</div>
</div>
</div>'.
$this->addParentItem($item, $deep).
'</li>';
}
private function addParentItem($item, $deep){
if($item->items){
$ret = '<ol class="dd-list dd-nodrag">';
foreach($item->items as $parent){
$ret .= $this->addItem($parent, $deep+1);
}
$ret .='</ol>';
return $ret;
}
return;
}
public function isParentless(){
return $this->parentless ? true : false;
}
public function makeParentlessHtml(){
$ret = "";
foreach($this->parentless as $item){
$ret .= '<li class="dd-item dd-nodrag" data-id="'.$item->id.'">'.
'<div class="dd-handle">
<span class="'.($item->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($item->active_account ? 'text-primary' : 'text-danger').'"></span>
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level.' | '.$item->m_account.'</span>
<br><span class="small">'.
($item->active_account ?
'<strong>Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong> | Umsatz: '.$item->sales_volume_total_sum.' €</strong> | B: '.$item->sales_volume_total.' € | S: '.$item->sales_volume_total_shop.' €'.
' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$item->id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>'
:
'Account bis: '.$item->payment_account_date).
'<br>'.$item->m_sponsor_name.
'</span>
</span>
</div>'.
'</li>';
}
return $ret;
}
public function makeSponsorHtml(){
if($this->sponsor){
//' | <a href="' . route('admin_business_user_detail', [$this->sponsor->id]) . '" class="btn icon-btn btn-xs btn-secondary"><span class="far fa-calculator"></span></a>'
$ret = '<li class="dd-item dd-nodrag" data-id="">'.
'<div class="dd-handle">
<span class="'.($this->sponsor->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($this->sponsor->active_account ? 'text-primary' : 'text-danger').'"></span>
<strong>'.$this->sponsor->first_name.' '.$this->sponsor->last_name.'</strong> <a href="mailto: '.$this->sponsor->email.'">'.$this->sponsor->email.'</a> <span class="badge badge-outline-default '.($this->sponsor->active_account ? '' : 'text-muted').'">'.$this->sponsor->user_level.' | '.$this->sponsor->m_account.'</span>';
if($this->init_from === 'admin'){
$ret .= '<br><span class="small">'.
($this->sponsor->active_account ?
'<strong>Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | B: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong> | Umsatz: '.$this->sponsor->sales_volume_total_sum.' €</strong> | B: '.$this->sponsor->sales_volume_total.' € | S: '.$this->sponsor->sales_volume_total_shop.' €'
:
'Account bis: '.$this->sponsor->payment_account_date).
'</span>';
}
$ret .= '</span>
</div>
</li>';
return $ret;
}
return 'Keinen Sponsor zugewiesen';
}
}

View file

@ -0,0 +1,114 @@
<?php
namespace App\Services\BusinessPlan;
use App\User;
use Carbon\Carbon;
class TreeUserItem
{
public $items = [];
private $date;
public function __construct($date)
{
$this->date = $date;
return $this;
}
public function makeUser(User $user){
$this->id = $user->id;
$this->m_level = $user->m_level;
$this->m_sponsor = $user->m_sponsor;
$this->user_level = $user->user_level ? $user->user_level->name : '';
$this->active_account = $user->payment_account ? Carbon::parse($user->payment_account)->gt(Carbon::parse($this->date->start_date)) : false;
$this->payment_account_date = $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
$this->active_date = $user->active_date ? $user->getActiveDateFormat() : "-";
$this->m_account = $user->account->m_account;
$this->email = $user->email;
$this->first_name = $user->account->first_name;
$this->last_name = $user->account->last_name;
$this->sales_volume_points = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points');
$this->sales_volume_points_shop = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_shop');
$this->sales_volume_points_sum = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_sum');
$this->sales_volume_total = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total');
$this->sales_volume_total_shop = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_shop');
$this->sales_volume_total_sum = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_sum');
if($user->user_level){
$this->margin = $user->user_level->margin;
$this->margin_shop = $user->user_level->margin_shop;
$this->qual_kp = $user->user_level->qual_kp;
$this->qual_tp = $user->user_level->qual_tp;
}else{
$this->margin = 0;
$this->margin_shop = 0;
$this->qual_kp = 0;
$this->qual_tp = 0;
}
}
public function addUserID(){
TreeCalcBot::addUserID($this->id);
}
public function isQualKP(){
return ($this->sales_volume_points_sum >= $this->qual_kp) ? true : false;
}
public function getRestQualKP(){
return $this->sales_volume_points_sum - $this->qual_kp;
}
public function checkSponsor(){
if($this->m_sponsor === null){
$this->m_sponsor_name = 'Keinen Sponsor zugewiesen';
return;
}
$user = User::find($this->m_sponsor);
if($user){
if($user->account){
$this->m_sponsor_name = 'Sponsor: '.$user->account->first_name.' '.$user->account->last_name.' | '.$user->email.' | '.$user->account->m_account;
}else{
$this->m_sponsor_name = 'Sponsor: '.$user->email;
}
return;
}
$this->m_sponsor_name = 'Sponsor wurde gelöscht.';
return;
}
public function readParentsUser(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.m_sponsor', "=", $this->id) //<- need the id for parents / sponsors
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
if($users){
foreach($users as $user){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem; }
}
foreach($this->items as $item){
$item->readParentsUser();
}
}
}

View file

@ -1,352 +0,0 @@
<?php
namespace App\Services;
use App\Models\Attribute;
use App\Models\Category;
use App\Models\Country;
use App\Models\Ingredient;
use App\Models\Product;
use App\Models\ShippingCountry;
use App\Models\ShoppingUser;
use App\Models\UserLevel;
use App\User;
class HTMLHelper
{
private static $months = [
1 => 'Januar',
2 => 'Februar',
3 => 'März',
4 => 'April',
5 => 'Mai',
6 => 'Juni',
7 => 'Juli',
8 => 'August',
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'Dezember',
];
private static $roles = [
0 => 'Kunde',
1 => 'Admin',
2 => 'SuperAdmin',
3 => 'SySAdmin',
];
public static function getMonth($i){
return self::$months[intval($i)];
}
public static function getRoleLabel($role_id = 0){
return '<span class="badge badge-pill '.self::getLabel($role_id).'">'.self::$roles[$role_id].'</span>';
}
public static function getLabel($id){
switch ($id) {
case 0:
return 'badge-default';
break;
case 1:
return 'badge-warning';
break;
case 2:
return 'badge-primary';
break;
case 3:
return 'badge-primary';
break;
}
}
public static function getRolesOptions(){
$ret = "";
foreach (self::$roles as $role_id => $value){
$ret .= '<option value="'.$role_id.'">'.$value.'</option>\n';
}
return $ret;
}
public static function getYearSelectOptions(){
$start = date("Y", strtotime("-5 years", time()));
$end = date("Y", strtotime("+1 years", time()));
$values = range($start, $end);
$now = date("Y", time());
$ret = "";
foreach ($values as $value){
$attr = ($value == $now) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
public static function getAttributesWithoutParents($id = false, $sameId = false, $all = true){
$values = Attribute::where('parent_id', null)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
if($sameId == $value->id){
continue;
}
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getCategoriesWithoutParents($id = false, $sameId = false, $all = true){
$values = Category::where('parent_id', null)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
if($sameId == $value->id){
continue;
}
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getProductsOptions($ids = array(), $all = true){
if($ids == null){
$ids = array();
}
$values = Product::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getCategoriesOptions($ids = array(), $all = true){
$values = Category::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getProductIngredientsOptions($has_ids = array(), $all = true){
$values = Ingredient::where('active', 1)->get();
$ret = "";
$attr = "";
foreach ($values as $value){
if(!in_array($value->id, $has_ids)){
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
}
return $ret;
}
public static function getAttributesOptions($ids = array(), $all = true){
$values = Attribute::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getUserLevelOptions($id = false, $all = true){
$values = UserLevel::where('active', 1)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('no').'</option>\n';
}
foreach ($values as $value){
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
}
return $ret;
}
public static function getCompanyOptions($company){
$options = array(1 => __('business'), 0 => __('private'), );
$ret = "";
foreach ($options as $id => $value){
$attr = ($id == $company) ? 'selected="selected"' : '';
$ret .= '<option value="'.$id.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
public static function getContriesWithMore($id, $all=true){#
$values = Country::all();
$counter = 1;
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
if( $counter == 7){
$ret .= '<optgroup label="'.__('further countrie').'">';
}
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->getLocated().'</option>\n';
$counter ++;
}
$ret .= '</optgroup>';
return $ret;
}
public static function getContriesCodes($id, $all=true){#
$values = Country::all();
$counter = 1;
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
if(!$value->phone) continue;
if( $counter == 7){
$ret .= '<optgroup label="'.__('further countrie').'">';
}
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->phone.'('.$value->getLocated().')</option>\n';
$counter ++;
}
$ret .= '</optgroup>';
return $ret;
}
public static function getCountriesWithoutUsedShippings($all=true){#
$values = Country::all();
$country_ids = ShippingCountry::all()->pluck('country_id')->toArray();
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
if(!in_array($value->id, $country_ids)){
$ret .= '<option value="'.$value->id.'">'.$value->getLocated().'</option>\n';
}
}
return $ret;
}
public static function getCountryNameFormShipping($id){
$value = ShippingCountry::find($id);
if($value){
return $value->country->getLocated();
}
return "not defined";
}
public static function getCountriesForShipping($id, $all=false){#
$values = ShippingCountry::all();
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->country->getLocated().'</option>\n';
}
return $ret;
}
public static function getSalutation($id){
$values = array('mr' => __('MR'), 'ms' => __('MS'));
$ret = "";
$ret .= '<option value="">'.__('please select').'</option>\n';
foreach ($values as $key => $value){
$attr = ($key == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
public static function getSalutationLang($id){
$values = array('mr' => __('MR'), 'ms' => __('MS'));
return (!empty($values[$id]) ? $values[$id] : '');
}
public static function getTaxSaleOptions($id){
$values = array('1' => __('taxable_sales_1'), '2' => __('taxable_sales_2'));
$ret = "";
$ret .= '<option value="">'.__('please select').'</option>\n';
foreach ($values as $key => $value){
$attr = ($key == $id) ? 'selected="selected"' : '';
$ret .= '<option value="'.$key.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
public static function getMembersOptions($id, $all=false){
$values = User::where('active', '=', true)->where('blocked', '=', false)->where('payment_account', '>=', now())->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$to="";
if($value->account){
$to = $value->account->first_name." ".$value->account->last_name." | ";
}
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.$value->email.' #'.$value->number.'</option>\n';
}
return $ret;
}
public static function getUserCustomerOptions($id, $all=false){
$values = ShoppingUser::select(['id', 'billing_firstname', 'billing_lastname', 'billing_email', 'number'])
->where('shopping_users.member_id', '=', \Auth::user()->id)->get();
$ret = "";
if($all){
$ret .= '<option value="">'.__('please select').'</option>\n';
}
foreach ($values as $value){
dump($value);
$attr = ($value->id == $id) ? 'selected="selected"' : '';
$to = $value->billing_firstname." ".$value->billing_lastname." | ".$value->billing_email;
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.' #'.$value->number.'</option>\n';
}
return $ret;
}
public static function getOptionRange($select, $from=1, $to=50){
$values = range($from, $to);
$ret = "";
foreach ($values as $value){
$attr = ($value == $select) ? 'selected="selected"' : '';
$ret .= '<option value="'.$value.'" '.$attr.'>'.$value.'</option>\n';
}
return $ret;
}
}

View file

@ -15,7 +15,7 @@ class HTMLHelper
{
private static $months = [
public static $months = [
1 => 'Januar',
2 => 'Februar',
3 => 'März',
@ -27,7 +27,7 @@ class HTMLHelper
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'Dezember',
12 => 'Dezember'
];
@ -43,6 +43,13 @@ class HTMLHelper
return self::$months[intval($i)];
}
public static function getYearRange($start = 2021)
{
$end = date("Y");
return array_reverse(range($start, $end));
}
public static function getRoleLabel($role_id = 0){
return '<span class="badge badge-pill '.self::getLabel($role_id).'">'.self::$roles[$role_id].'</span>';
}

View file

@ -74,7 +74,7 @@ class Payment
/*
Wir bei Zahlung aufgerufen.
Betätigung durch Payone oder Zahlung auf MIVITA Rechnung
$paid = Status der Zahlung, Payone = true, MIVITA Rechnung = false
$paid = Status der Zahlung, Payone = true, MIVITA Rechnung = false damit kann später die rechnung auf bezahlt gesetzt werden.
*/
public static function paymentStatusPaidAction(ShoppingOrder $shopping_order, $paid){

View file

@ -17,7 +17,7 @@ class PaymentHelper
public function setProduct($product){
Yard::instance('shopping')->destroy();
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, false, false, ['image' => "", 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, false, false, ['image' => "", 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
}
public function initELVPayment($user){
@ -153,7 +153,7 @@ class PaymentHelper
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];

View file

@ -1,29 +0,0 @@
<?php
namespace App\Services;
use App\User;
class PriceService
{
public static $country;
public static function createConfirmationCode() {
$unique = false;
do{
$confirmation_code = str_random(30);
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
$unique = true;
}
}
while(!$unique);
return $confirmation_code;
}
}

View file

@ -0,0 +1,304 @@
<?php
namespace App\Services\SyS;
use Carbon;
use Request;
use App\Models\Product;
use App\Models\Homeparty;
use App\Models\SySetting;
use App\Models\ShoppingUser;
use App\Models\ShoppingOrder;
use App\Models\UserSalesVolume;
use App\Models\ShoppingOrderItem;
use App\Repositories\ImportRepository;
class Correction
{
private static function userSalesVolume($order){
/*
status
1 => 'hinzugefügt aus Bestellung',
2 => 'hinzugefügt aus Shop',
3 => 'hinzugefügt aus Shop / pending',
*/
$status = UserSalesVolume::getStatusByOrder($order);
$user_id = $order->auth_user_id ? $order->auth_user_id : $order->member_id;
//akuteller tag / Monat.
$month = $order->created_at->format('m');
$year = $order->created_at->format('Y');
$date = $order->created_at->format('d.m.Y');
if($status === 3){ //shop bestellung User pending
$user_id = $order->auth_user_id ? $order->auth_user_id : $order->member_id;
$month_points = 0;
$month_total_net = 0;
$month_shop_points = 0;
$month_shop_total_net = 0;
}else{
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
}
switch ($status) {
case 1: //Bestellung
$month_points += $order->points;
$month_total_net += $order->subtotal;
break;
case 2: //Shop
$month_shop_points += $order->points;
$month_shop_total_net += $order->subtotal;
break;
}
return UserSalesVolume::create([
'user_id' => $user_id,
'shopping_order_id' => $order->id,
'month' => $month,
'year' => $year,
'date' => $date,
'points' => $order->points,
'month_points' => $month_points,
'month_shop_points' => $month_shop_points,
'total_net' => $order->subtotal,
'month_total_net' => $month_total_net,
'month_shop_total_net' => $month_shop_total_net,
'message' => '',
'status' => $status,
]);
}
public static function show()
{
// abort(403, 'STOP funtion not online');
$c = 0;
if(true){ //11
dump("calculate user_sales_volumes from Orders");
//dd('check function');
$year = 21;
$months = range(1, 12);
foreach($months as $month){
$ShoppingOrders = ShoppingOrder::where('txaction', 'paid')->where('created_at', '>=', $year.'-'.$month.'-01 00:00:00')->where('created_at', '<=', $year.'-'.$month.'-31 23:59:59')->get();
foreach($ShoppingOrders as $item){
if(UserSalesVolume::whereShoppingOrderId($item->id)->count() === 0){
dump($item->id);
self::userSalesVolume($item);
}
$c ++;
}
}
dump("counter");
dd($c);
}
if(false){ //11
dump("set Discount to Order Items");
dd('check function');
$ShoppingOrderItems = ShoppingOrderItem::where('discount', null)
//$ShoppingOrderItems = ShoppingOrderItem::where('discount', 0)->get();
->skip(0)->take(1000)->get();
//->skip(2000)->take(2000)->get();
foreach($ShoppingOrderItems as $item){
$no_commission = $item->product ? $item->product->no_commission : false;
$item->discount = $no_commission ? 0 : $item->shopping_order->getUserDiscount();
$item->save();
//dump($item->discount);
$c ++;
}
dump("counter");
dd($c);
}
if(false){ //10
dump("set ProduktPoints to Order Items");
dd('check function');
$ShoppingOrderItems = ShoppingOrderItem::where('points', null)->get();
$ShoppingOrderItems = ShoppingOrderItem::where('points', 0)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
if($item->product){
$item->points = $item->product->points;
$item->save();
}else{
}
$c ++;
}
dd($c);
}
if(false){ //9
dump("make homeparty tax_split in shopping_order");
dd('check function');
$ShoppingOrders = ShoppingOrder::where('payment_for', '=', NULL)->get();
foreach($ShoppingOrders as $ShoppingOrder){
dump($ShoppingOrder->id);
dump($ShoppingOrder->shopping_user->getOrderPaymentFor());
$ShoppingOrder->payment_for = $ShoppingOrder->shopping_user->getOrderPaymentFor();
$ShoppingOrder->save();
$c ++;
}
dd($c);
}
if(false){ //8
dump("make homeparty tax_split in shopping_order");
dd('check function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeHomepartyTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //7
dump("make homeparty shipping_tax in homeparty order user_cart");
dd('check function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
if(isset($ShoppingOrder->homeparty->order['user_carts'])){
$user_carts = [];
foreach($ShoppingOrder->homeparty->order['user_carts'] as $id => $values){
$values['shipping_tax'] = round($values['shipping_price'] - $values['shipping_price_net'], 2);
dump($values['shipping_tax']);
$user_carts[$id] = $values;
}
$order = $ShoppingOrder->homeparty->order;
$order['user_carts'] = $user_carts;
$ShoppingOrder->homeparty->order = $order;
$ShoppingOrder->homeparty->save();
}
$c ++;
}
dd($c);
}
if(false){ //6
dump("make tax_split in shopping_order");
dd('check function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //5
//run after make points etc.
dump("correction shopping_order homeparty");
dd('check function');
$ShoppingOrders = ShoppingOrder::where('payment_for', 5)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$homeparty = Homeparty::find($ShoppingOrder->homeparty_id);
if($homeparty && $homeparty->completed && $homeparty->step > 10){
$ShoppingOrder->subtotal = $homeparty->order['ek_price_net'];
$ShoppingOrder->subtotal_ws = 0;
$ShoppingOrder->tax = $ShoppingOrder->total - $homeparty->order['ek_price_net'];
$ShoppingOrder->points = $homeparty->order['points'] - $homeparty->order['bonus_points_diff'];
$ShoppingOrder->save();
$c ++;
}
}
dd($c);
}
if(false){ //4
dump("make tax in ShoppingOrderItem");
dd('check function');
$ShoppingOrderItems = ShoppingOrderItem::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->tax = $item->price - $item->price_net;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //3
dump("make price_net in ShoppingOrderItem");
dd('check function');
$ShoppingOrderItems = ShoppingOrderItem::where('price_net', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->price_net = $item->price / (100 + $item->tax_rate) * 100;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //2
dump("add payment_for in shopping_order");
dd('check function');
$ShoppingUsers = ShoppingUser::all();
foreach($ShoppingUsers as $ShoppingUser){
if($ShoppingUser->shopping_order){
$ShoppingUser->shopping_order->payment_for = $ShoppingUser->getOrderPaymentFor();
$ShoppingUser->shopping_order->save();
$c ++;
}
}
dd($c);
}
if(false){ //1
dump("make points in shopping_order_item and total in ShoppingOrder");
dd('check function');
$ShoppingOrders = ShoppingOrder::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$points_total = 0;
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
$points = $shopping_order_item->product ? $shopping_order_item->product->points : 0;
$points_total += $points;
$shopping_order_item->points = $points;
$shopping_order_item->save();
$c ++;
}
$ShoppingOrder->points = $points_total;
$ShoppingOrder->save();
}
dd($c);
}
}
public static function store()
{
abort(403, 'STOP funtion not online');
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Services\SyS;
use Request;
class Cronjobs
{
public static function show()
{
//$user_shops = UserShop::all();
$text = "";
$values = [
'Prüft die Dauer der Mitgliedschaft und sendet Erinnerungsmails' => route('cron_jobs_action', ['check_payments_account', 'key'])
];
$data = [
'values' => $values,
'text' => $text,
];
return view('sys.tools.cronjobs', $data);
}
public static function store()
{
$data = Request::all();
\Session()->flash('alert-save', true);
return back();
}
}

View file

@ -0,0 +1,63 @@
<?php
namespace App\Services\SyS;
use Auth;
use Request;
use App\User;
use App\Models\ShoppingUser;
use App\Models\PaymentMethod;
use App\Services\CustomerPriority;
use App\Repositories\ContractPDFRepository;
class Customers
{
public static function show()
{
$shopping_users = ShoppingUser::where('member_id', '=', NULL)->where('auth_user_id', '=', NULL)->get();
$data = [
'values' => $shopping_users,
'text' => '',
];
return view('sys.tools.customers', $data);
}
public static function store()
{
$data = Request::all();
$ret = "";
if($data['action'] === 'makePaymentMethodsDefault'){
$users = User::where('payment_methods', '=', NULL)->get();
//$users = User::all();
foreach ($users as $user){
$user->payment_methods = PaymentMethod::getDefaultAsArray();
$user->save();
}
}
if($data['action'] === 'checkForAll'){
$shopping_users = CustomerPriority::checkForAll();
}
if($data['action'] === 'checkContractPDF'){
//create PDF
$user = User::findOrFail(80);
$pdf = new ContractPDFRepository($user);
$pdf->_set('disk', 'user');
$pdf->_set('dir', '/'.$user->id.'/documents/');
$pdf->_set('user_id', $user->id);
$pdf->_set('identifier', 'contract');
$pdf->createContractPDF();
}
if(strpos($data['action'], 'checkOne_') !== false){
$id = (int) str_replace('checkOne_', '', $data['action']);
$shopping_user = ShoppingUser::findOrFail($id);
$ret = CustomerPriority::checkOne($shopping_user);
}
\Session()->flash('alert-success', $ret);
return back();
}
}

View file

@ -0,0 +1,104 @@
<?php
namespace App\Services\SyS;
use Request;
use App\Models\UserShop;
use App\Http\Controllers\Api\KasController;
use App\Http\Controllers\Api\KasSLLController;
class DomainSSL
{
public static function show()
{
$user_shops = UserShop::limit(1000)->get();
$text = "";
$kas = new KasController();
//$domain = 'mivita.care';
// $ssl = KasSLLController::getApiSSLParameter();
$SubDomains = [];
$get_subdomains = $kas->action('get_subdomains');
foreach ($get_subdomains as $subdomain){
if(strpos($subdomain['subdomain_name'], 'www.') !== false){
continue;
}
if(strpos($subdomain['subdomain_name'], 'api.') !== false){
continue;
}
if(strpos($subdomain['subdomain_name'], 'checkout.') !== false){
continue;
}
$SubDomains[$subdomain['subdomain_name']] = $subdomain['ssl_certificate_sni'];
/* if($subdomain['ssl_certificate_sni'] !== "Y"){
$pra = array(
'hostname' => $subdomain['subdomain_name'],
);
$pra = array_merge($pra, $ssl);
$value = $kas->action('update_ssl', $pra);
$text .= $value;
}else{
if(isset($subdomain['ssl_certificate_sni_is_active'])){
$text .= $subdomain['ssl_certificate_sni_is_active'].'-is_active';
}else{
$text .= '-CHECK!';
}
}*/
//$text .= "\n";
}
foreach($user_shops as $user_shop){
$user_shop->hasSubdomain = false;
$user_shop->hasSSL = false;
if(array_key_exists($user_shop->slug.'.mivita.care', $SubDomains)){
$user_shop->hasSubdomain = true;
$user_shop->hasSSL = $SubDomains[$user_shop->slug.'.mivita.care'] === 'Y' ? true : false;
unset($SubDomains[$user_shop->slug.'.mivita.care']);
}
}
$data = [
'values' => $user_shops,
'text' => $text,
'SubDomains' => $SubDomains,
];
return view('sys.tools.domain-ssl', $data);
}
public static function store()
{
$data = Request::all();
if(isset($data['delete_sub_kas'])){
$kas = new KasController();
$pra = array(
'subdomain_name' => $data['delete_sub_kas'],
);
$value = $kas->action('delete_subdomain', $pra);
\Session()->flash('alert-success', 'subdomain: '.$value.' gelöscht');
}
if(isset($data['delete_user_shop'])){
$user_shop = UserShop::findOrFail($data['delete_user_shop']);
$subdomain_name = $user_shop->slug.'.mivita.care';
$user_shop->name = "delete".$user_shop->id;
$user_shop->slug = "delete".$user_shop->id;
$user_shop->save();
$user_shop->delete();
$kas = new KasController();
$pra = array(
'subdomain_name' => $subdomain_name,
);
$value = $kas->action('delete_subdomain', $pra);
\Session()->flash('alert-success', 'shop/subdomain: '.$value.' gelöscht');
}
return back();
}
}

View file

@ -0,0 +1,49 @@
<?php
namespace App\Services\SyS;
use Carbon;
use Request;
use App\Models\SySetting;
use App\Repositories\ImportRepository;
class Import
{
public static function show()
{
abort(403, 'STOP funtion not online');
return view('sys.tools.import', []);
}
public static function store()
{
abort(403, 'STOP funtion not online');
}
public function importStore()
{
$input = Request::all();
$import_repo = new ImportRepository();
return $import_repo->upload($input);
}
public function importShow($type, $file, $skip = 0, $limit = 4000)
{
$import_repo = new ImportRepository();
$import = $import_repo->read($type, $file, $skip, $limit);
$data = [
'limit' => $limit,
'type' => $type,
'file' => $file,
'import' => $import,
'skip' => $skip,
];
return view('sys.tools.import-show', $data);
}
}

View file

@ -1,25 +1,15 @@
<?php
namespace App\Http\Controllers\SyS;
namespace App\Services\SyS;
use Request;
use Carbon;
use App\Models\SySetting;
use App\Models\ShoppingOrder;
use App\Http\Controllers\Controller;
class SalesController extends Controller
class Sales
{
protected $userRepo;
public function __construct()
{
$this->middleware('sysadmin');
}
public function index()
public static function show()
{
$start = 2019;
$end = date('Y');
@ -50,11 +40,11 @@ class SalesController extends Controller
'active_year' => $active_year,
'values' => $values,
];
return view('sys.sales.index', $data);
return view('sys.tools.sales', $data);
}
public function store()
public static function store()
{
$data = Request::all();
@ -68,11 +58,8 @@ class SalesController extends Controller
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('sysadmin_settings'));
return redirect(route('sysadmin_tool', ['sales_members']));
}
}

View file

@ -0,0 +1,64 @@
<?php
namespace App\Services\SyS;
use Request;
use App\Services\Shop;
use App\Models\UserShop;
use App\Models\ShoppingUser;
use App\Http\Controllers\Api\KasController;
use App\Http\Controllers\Api\KasSLLController;
class ShoppingOrders
{
public static function show()
{
abort(403, 'STOP funtion not online');
$shopping_users = ShoppingUser::all();
$data = [
'values' => $shopping_users,
'text' => '',
];
return view('sys.tools.shopping-orders', $data);
}
public static function store()
{
abort(403, 'STOP funtion not online');
dd("");
$data = Request::all();
if($data['action'] === 'first_run'){
$shopping_users = ShoppingUser::whereHas('shopping_order', function($q) {
$q->where('txaction', 'paid')->OrWhere('txaction', 'appointed');
})->get();
$order_email = [];
$order_number = [];
foreach ($shopping_users as $shopping_user){
$order_email[$shopping_user->billing_email] = isset($order_email[$shopping_user->billing_email]) ? $order_email[$shopping_user->billing_email] + 1 : 1;
if($shopping_user->number) {
$order_number[$shopping_user->number] = isset($order_number[$shopping_user->number]) ? $order_number[$shopping_user->number] + 1 : 1;
$shopping_user->orders = $order_number[$shopping_user->number];
}else {
$shopping_user->orders = $order_email[$shopping_user->billing_email];
}
$shopping_user->save();
}
\Session()->flash('alert-save', true);
}
if($data['action'] === 'next_run'){
Shop::userOrders();
\Session()->flash('alert-save', true);
}
return back();
}
}

View file

@ -1,13 +0,0 @@
<?php
namespace App\Services;
class TaxPriceHelper
{
public static function userOrders() {
}
}

View file

@ -110,6 +110,4 @@ class UserService
return $confirmation_code;
}
}

View file

@ -6,6 +6,7 @@ use App\Models\Country;
use App\Models\UserHistory;
use Illuminate\Support\Str;
use App\Models\ShippingCountry;
use Request;
class Util
{
@ -205,7 +206,6 @@ class Util
if(\Session::has('user_shop_payment')){
return \Session::get('user_shop_payment');
}
return null;
}
@ -245,9 +245,25 @@ class Util
}
public static function isMivitaShop(){
if(Request::getHost() === 'checkout.'.config('app.domain').config('app.tld_care')){
if($user_shop = \Session::get('user_shop')){
if($user_shop->slug === 'aloevera' || $user_shop->slug === 'naturcosmetic'){
return true;
}
}
}
if(Request::getHost() === 'naturcosmetic.'.config('app.domain').config('app.tld_care')){
return true;
}
return \Config::get('app.url') === config('app.domain').config('app.tld_shop');
}
public static function isTestSystem(){
if(\Config::get('app.tld_care') === '.test' || \Config::get('app.tld_shop') === '.lshop'){
return true;
}
return false;
}
public static function sanitize($string, $force_lowercase = true, $anal = false, $substr = false)
{

View file

@ -8,6 +8,7 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Mail;
use App\Mail\MailResetPassword;
use App\Models\UserSalesVolume;
use Illuminate\Database\Eloquent\SoftDeletes;
use Laravel\Passport\HasApiTokens;
@ -149,6 +150,7 @@ class User extends Authenticatable
'password', 'remember_token', 'token',
];
private $userSalesVolume = false;
public function account(){
return $this->belongsTo('App\Models\UserAccount', 'account_id');
@ -463,4 +465,40 @@ class User extends Authenticatable
// $this->notify(new ResetPasswordNotification($token));
}
public function getUserSalesVolumeBy($month, $year, $key)
{
if($this->userSalesVolume === false){
$this->userSalesVolume = UserSalesVolume::where('user_id', $this->id)->where('month', $month)->where('year', $year)->get()->last();
}
if($this->userSalesVolume){
switch ($key) {
case 'sales_volume_points':
return $this->userSalesVolume->month_points;
break;
case 'sales_volume_points_shop':
return $this->userSalesVolume->month_shop_points;
break;
case 'sales_volume_points_sum':
return $this->userSalesVolume->month_points + $this->userSalesVolume->month_shop_points;
break;
case 'sales_volume_total':
return formatNumber($this->userSalesVolume->month_total_net);
break;
case 'sales_volume_total_shop':
return formatNumber($this->userSalesVolume->month_shop_total_net);
break;
case 'sales_volume_total_sum':
return formatNumber($this->userSalesVolume->month_total_net + $this->userSalesVolume->month_shop_total_net);
break;
}
}
return 0;
}
}

View file

@ -41,6 +41,8 @@ class CreateProductsTable extends Migration
$table->unsignedTinyInteger('unit')->nullable();
$table->string('number')->nullable();
$table->string('ean')->nullable();
$table->unsignedInteger('wp_number')->nullable();
$table->string('icons')->nullable(); //as array cast

View file

@ -70,6 +70,9 @@ class CreateUserAccountsTable extends Migration
$table->string('instagram')->nullable();
$table->text('payment_data')->nullable();
$table->string('bank_owner')->nullable();
$table->string('bank_iban')->nullable();
$table->string('bank_bic')->nullable();
$table->timestamp('data_protection')->nullable();
$table->timestamp('accepted_contract')->nullable();

View file

@ -18,12 +18,23 @@ class CreateUserLevelsTable extends Migration
$table->string('name')->index();
$table->text('trans_name')->nullable();
$table->decimal('margin', 8, 2)->nullable();
$table->unsignedTinyInteger('margin')->nullable();
$table->unsignedTinyInteger('margin_shop')->nullable();
$table->unsignedSmallInteger('qual_kp')->nullable();
$table->unsignedInteger('qual_tp')->nullable();
$table->unsignedTinyInteger('growth_bonus')->nullable();
$table->unsignedTinyInteger('pr_line_1')->nullable();
$table->unsignedTinyInteger('pr_line_2')->nullable();
$table->unsignedTinyInteger('pr_line_3')->nullable();
$table->unsignedTinyInteger('pr_line_4')->nullable();
$table->unsignedTinyInteger('pr_line_5')->nullable();
$table->unsignedTinyInteger('pr_line_6')->nullable();
$table->tinyInteger('pos')->unsigned()->nullable();
$table->boolean('active')->default(false);
$table->boolean('default')->default(false);
$table->timestamps();

View file

@ -40,5 +40,8 @@ return [
'payments' => 'Finanzen',
'invoice' => 'Rechnungen',
'credit' => 'Gutschriften',
'system_settings' => 'System-E.'
'system_settings' => 'System-E.',
'business' => 'Business',
'structure' => 'Struktur',
];

View file

@ -206,7 +206,7 @@ return [
'shipping_address'=>'Adresse',
'shipping_zipcode'=>'PLZ',
'shipping_city' => 'Stadt',
'm_account' => 'Account ID',
'm_account' => 'Berater-ID',
'has_customer_buyed' => 'Die Angabe',
'billing_country_code' => 'Land Code',
'sales_partnership' => 'Vertriebspartnerschaft',

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Attribute')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -0,0 +1,109 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h6 class="card-header">
{{__('Business')}}
</h6>
<div class="card-body p-0">
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_payment_invoices']) !!}
<div class="form-row align-items-center px-4 pb-2 pt-3">
{{-- <div class="col-12 col-sm-4 col-md-4 col-lg-4 mb-1">
<input class="form-control on_keyup_invoice" name="business_user_filter_name" type="text" value="{{session('business_user_filter_name')}}" placeholder="Name">
</div>
--}}
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="business_user_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('business_user_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="business_user_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('business_user_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered" id="datatable-users">
<thead>
<tr>
<th>{{__('ID') }}</th>
<th>{{__('Berater-ID') }}</th>
<th>{{__('Points')}}</th>
<th>{{__('Points Shop')}}</th>
<th>{{__('Gesamt')}}</th>
<th>{{__('Umsatz')}}</th>
<th>{{__('Umsatz Shop')}}</th>
<th>{{__('Gesamt Shop')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname')}}</th>
<th>{{__('Level')}}</th>
<th>{{__('Mitglied')}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatable-users').DataTable({
"processing": true,
"serverSide": true,
"stateSave": true,
"searching": true,
ajax: {
url: '{!! route('admin_business_user_datatable') !!}',
data: function(d) {
d.business_user_filter_name = $('input[name=business_user_filter_name]').val();
d.business_user_filter_month = $('select[name=business_user_filter_month]').val();
d.business_user_filter_year = $('select[name=business_user_filter_year]').val();
}
},
"order": [[0, "asc" ]],
"columns": [
{ data: 'id', name: 'users.id', searchable: false },
{ data: 'account.m_account', name: 'account.m_account' },
{ data: 'sales_volume_points', name: 'sales_volume_points', orderable: false, searchable: false },
{ data: 'sales_volume_points_shop', name: 'sales_volume_points_shop', orderable: false, searchable: false },
{ data: 'sales_volume_points_sum', name: 'sales_volume_points_sum', orderable: false, searchable: false },
{ data: 'sales_volume_total', name: 'sales_volume_total', orderable: false, searchable: false },
{ data: 'sales_volume_total_shop', name: 'sales_volume_total_shop', orderable: false, searchable: false },
{ data: 'sales_volume_total_sum', name: 'sales_volume_total_sum', orderable: false, searchable: false },
{ data: 'email', name: 'users.email' },
{ data: 'account.first_name', name: 'account.first_name' },
{ data: 'account.last_name', name: 'account.last_name' },
{ data: 'user_level', name: 'user_level', orderable: false, searchable: false },
{ data: 'active_account', name: 'active_account' },
],
"bLengthChange": false,
"iDisplayLength": 100,
"language": {
"url": "/js/German.json"
}
});
$('select.on_change_invoice').on('change', function(){
oTable.draw();
});
$('input.on_keyup_invoice').on('keyup', function(){
oTable.draw();
});
});
/*$('#filter_sales_year').on('change', function(){
$('#form_filter_payment_invoices').submit();
});*/
</script>
@endsection

View file

@ -0,0 +1,113 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
{{__('Business')}} {{__('Übersicht')}}
</h5>
<div class="card-body p-0">
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_business_user']) !!}
<div class="form-row align-items-center px-4 pb-2 pt-3">
{{-- <div class="col-12 col-sm-4 col-md-4 col-lg-4 mb-1">
<input class="form-control on_keyup_invoice" name="business_user_filter_name" type="text" value="{{session('business_user_filter_name')}}" placeholder="Name">
</div>
--}}
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="business_user_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('business_user_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="business_user_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('business_user_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="business_user_filter_active">
@foreach($filter_active as $key=>$value)
<option value="{{$key}}" @if(session('business_user_filter_active') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered" id="datatable-users">
<thead>
<tr>
<th>{{__('ID') }}</th>
<th>{{__('Berater-ID') }}</th>
<th>{{ __('Level') }}</th>
<th>{{ __('KD') }}</th>
<th>{{__('Points')}}</th>
<th>{{__('Umsatz')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname')}}</th>
<th>{{__('Sponsor')}}</th>
<th>{{__('Account')}}</th>
<th>{{__('bis')}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatable-users').DataTable({
"processing": true,
"serverSide": true,
"stateSave": true,
"searching": true,
ajax: {
url: '{!! route('admin_business_user_datatable') !!}',
data: function(d) {
d.business_user_filter_name = $('input[name=business_user_filter_name]').val();
d.business_user_filter_month = $('select[name=business_user_filter_month]').val();
d.business_user_filter_year = $('select[name=business_user_filter_year]').val();
d.business_user_filter_active = $('select[name=business_user_filter_active]').val();
}
},
"order": [[1, "asc" ]],
"columns": [
{ data: 'id', name: 'users.id', searchable: false },
{ data: 'account.m_account', name: 'account.m_account' },
{ data: 'user_level', name: 'user_level' },
{ data: 'is_qual_kp', name: 'is_qual_kp', orderable: false, searchable: false },
{ data: 'sales_volume_points', name: 'sales_volume_points', orderable: false, searchable: false },
{ data: 'sales_volume_total', name: 'sales_volume_total', orderable: false, searchable: false },
{ data: 'email', name: 'users.email' },
{ data: 'account.first_name', name: 'account.first_name' },
{ data: 'account.last_name', name: 'account.last_name' },
{ data: 'sponsor', name: 'sponsor', orderable: false, searchable: false },
{ data: 'active_account', name: 'active_account' },
{ data: 'payment_account_date', name: 'payment_account_date' },
],
"bLengthChange": false,
"iDisplayLength": 100,
"language": {
"url": "/js/German.json"
}
});
$('select.on_change_invoice').on('change', function(){
oTable.draw();
});
$('input.on_keyup_invoice').on('keyup', function(){
oTable.draw();
});
});
</script>
@endsection

View file

@ -0,0 +1,90 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
{{__('Business')}} {{__('Struktur')}}
</h5>
<div class="card-body">
{!! Form::open(['url' => route('admin_business_structure'), 'class' => 'form-horizontal', 'id'=>'form_filter_business_user']) !!}
<div class="form-row align-items-center px-0 pb-2 pt-0">
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="business_user_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('business_user_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="business_user_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('business_user_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<hr class="container-m-nx border-light mt-0">
<div>
<div id="nestable-menu" class="mb-4">
<button type="button" class="btn btn-default btn-sm" data-action="expand-all">Alles aufklappen</button>
<button type="button" class="btn btn-default btn-sm" data-action="collapse-all">Alles zuklappen</button>
</div>
<div class="row">
<div class="col-md-12">
<div class="dd" id="nestable2">
{!! $TreeCalcBot->makeHtmlTree() !!}
</div>
</div>
</div>
@if($TreeCalcBot->isParentless())
<div class="row">
<div class="col-md-12">
<hr>
<h6 class="">
Berater ohne Sponsor
</h6>
<div class="dd" id="">
{!! $TreeCalcBot->makeParentlessHtml() !!}
</div>
</div>
</div>
@endif
</div>
</div>
<link rel="stylesheet" href="/vendor/libs/nestable/nestable.css">
<script src="/vendor/libs/nestable/jquery-nestable.js?v=1"></script>
<script>
$( document ).ready(function() {
function updateOutput(e) {
//var list = e.length ? e : $(e.target);
//var output = list.data('output');
};
$('#nestable2').nestable().on('change', updateOutput);
// output initial serialised data
//updateOutput($('#nestable2').data('output', $('#nestable2-output')));
$('#nestable-menu').on('click', function(e) {
var target = $(e.target);
var action = target.data('action');
if (action === 'expand-all') {
$('.dd').nestable('expandAll');
}
if (action === 'collapse-all') {
$('.dd').nestable('collapseAll');
}
});
});
$('.on_change_select_filter').on('change', function(){
$('#form_filter_business_user').submit();
});
</script>
@endsection

View file

@ -0,0 +1,157 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
{{__('Business')}} {{__('Übersicht')}} Berater
</h5>
<div class="media align-items-center pt-3 mb-0">
{{-- <img src="assets/img/avatars/5-small.png" alt="" class="d-block ui-w-100 rounded-circle">--}}
<div class="media-body ml-4">
<h4 class="font-weight-bold mb-0">{{ $user->account->first_name }} {{ $user->account->last_name }} <a class="font-weight-normal" href="mailto:{{ $user->email }}">{{ $user->email }}</a></h4>
</div>
</div>
<div class="card-body">
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Account ID:</td>
<td>{{ $user->account->m_account }}</td>
</tr>
<tr>
<td>Level:</td>
<td>
@if($user->user_level)
{{ $user->user_level->name }}
@else
-
@endif
</td>
</tr>
<tr>
<td>Kundenprovision:</td>
<td>
{{ $TreeCalcBot->user->margin }} %
</td>
</tr>
<tr>
<td>Shop Provision:</td>
<td>
{{ $TreeCalcBot->user->margin_shop }} %
</td>
</tr>
<tr>
<td>Account:</td>
<td>
@if($user->isActiveAccount())
<span class="badge badge-outline-success">aktiv</span>
@else
<span class="badge badge-outline-danger">nicht aktiv</span>
@endif
@if($user->payment_account)
bis: {{ $user->getPaymentAccountDateFormat(false) }}
@endif
</td>
</tr>
<tr>
<td>Sponsor:</td>
<td>@if($user->user_sponsor)
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->first_name }} {{ $user->user_sponsor->account->last_name }} |
@endif
{{ $user->email }} |
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->m_account }} |
@endif
<a href="{{ route('admin_business_user_detail', [$user->user_sponsor->id]) }}" class="btn icon-btn btn-xs btn-secondary"><span class="far fa-calculator"></span></a>
@else
-
@endif
</td>
</tr>
<tr>
<td>Datum:</td>
<td><strong>{{ $month }} {{ $year }}</strong></td>
</tr>
<tr>
<td>Points:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_points_sum }}</strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_points }} | Shop: {{ $TreeCalcBot->user->sales_volume_points_shop }}
</td>
</tr>
<tr>
<td>Umsatz:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_total_sum }} </strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_total }} | Shop: {{ $TreeCalcBot->user->sales_volume_total_shop }}
</td>
</tr>
<tr>
<td>Persönliches Volumen:</td>
<td>
<span class="badge {{ $TreeCalcBot->user->isQualKP() ? 'badge-outline-success' : 'badge-outline-danger' }}"> KD {{ $TreeCalcBot->user->qual_kp }}</span>
</td>
</tr>
<tr>
<td>Qualifikation:</td>
<td>
TP {{ formatNumber($TreeCalcBot->user->qual_tp, 0) }} /
@if($TreeCalcBot->user->isQualKP())
<strong> TP{{ formatNumber($TreeCalcBot->total_qual_tp, 0) }}</strong> &nbsp;
@if($TreeCalcBot->qual_user_level)
<span class="badge badge-outline-success">{{ formatNumber($TreeCalcBot->qual_user_level->qual_tp, 0) }} | {{ $TreeCalcBot->qual_user_level->name }}</span>
@endif
@else
<span class="ion ion-md-close text-danger"></span>
@endif
</td>
</tr>
</tbody>
</table>
</div>
<hr class="border-light m-0">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>Linie</th>
<th>Points</th>
<th>Provision</th>
<th>Provision</th>
</tr>
@for ($line=1; $line<=6; $line++)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }}</td>
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td>Gesamt</td>
<td>{{ formatNumber($TreeCalcBot->total_tp, 0) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->commission_total, 2) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<script>
$( document ).ready(function() {
});
</script>
@endsection

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Kategorien')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -1,7 +1,7 @@
<div class="card mb-2">
<h6 class="card-header">
<h5 class="card-header">
{{__('Produktliste')}} / {{ $category->name }}
</h6>
</h5>
<div class="mt-3 ml-3">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-categorie-products"
data-id="new"

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card mb-4">
<h6 class="card-header">
<h5 class="card-header">
{{$user->email}} | {{__('Change E-Mail')}}
</h6>
</h5>
<div class="card-body">
<div class="row">
<div class="col-sm-2"></div>

View file

@ -3,9 +3,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Länder')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Inhaltsstoffe')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -20,7 +20,7 @@
<tbody>
<tr>
<th>{{ __('Name') }}</th>
<th>{{ __('Account ID') }}</th>
<th>{{ __('Berater-ID') }}</th>
<th>{{ __('Karriere-Level') }}</th>
<th>{{ __('Sponsor') }}</th>
</tr>

View file

@ -3,9 +3,9 @@
<div class="card-body">
<div class="form-row">
<div class="form-group col-md-4">
<label for="m_account" class="form-label">{{ __('Account ID') }} (unique)</label>
<label for="m_account" class="form-label">{{ __('Berater-ID') }} (unique)</label>
<span class="badge badge-secondary float-right">Nächste freie ID: {{$next_account_id}}</span>
{{ Form::text('m_account', $user->account->m_account, array('placeholder'=>__('Account ID'), 'class'=>'form-control', 'id'=>'m_account')) }}
{{ Form::text('m_account', $user->account->m_account, array('placeholder'=>__('Berater-ID'), 'class'=>'form-control', 'id'=>'m_account')) }}
</div>
<div class="form-group col-md-4">
<label class="form-label">{{ __('Karriere-Level') }}</label>

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Karriere-Level')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
@ -12,30 +12,50 @@
<th style="max-width: 60px;">&nbsp;</th>
<th>{{__('Pos')}}</th>
<th>{{__('Description')}}</th>
<th>{{__('Marge') }}</th>
<th>{{__('Translate') }}</th>
<th>{{__('Nächste Ebene')}}</th>
<th>{{__('Pr.') }}</th>
<th>{{__('Pr.Shop') }}</th>
<th>{{__('Qual.KP') }}</th>
<th>{{__('Qual.TP') }}</th>
<th>{{__('Pr. L.1') }}</th>
<th>{{__('Pr. L.2') }}</th>
<th>{{__('Pr. L.3') }}</th>
<th>{{__('Pr. L.4') }}</th>
<th>{{__('Pr. L.5') }}</th>
<th>{{__('Pr. L.6') }}</th>
<th>{{__('W.Bonus') }}</th>
<th>{{__('Status')}}</th>
<th>{{__('Standard')}}</th>
<th>{{__('ID')}}</th>
</tr>
</thead>
<tbody>
@foreach($values as $value)
<tr>
<td>
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-default"
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $value->id }}"
data-pos="{{ $value->pos }}"
data-name="{{ $value->name }}"
data-margin="{{ $value->getFormattedMargin() }}"
data-trans_name="{{ json_encode($value->trans_name) }}"
data-active="{{ $value->active }}">
<span class="far fa-edit"></span>
</button>
data-action="user-level-edit"
data-view="view"
data-route="{{ route('modal_load') }}"><span class="fa fa-edit"></span></button>
</td>
<td>{{ $value->pos }}</td>
<td>{{ $value->name }}</td>
<td>{{ $value->getFormattedMargin() }}</td>
<td>{{ $value->getTranNames() }}</td>
<td>@if($value->next_user_level) {{ $value->next_user_level->name }} @endif</td>
<td>{{ $value->margin }}</td>
<td>{{ $value->margin_shop }}</td>
<td>{{ $value->qual_kp }}</td>
<td>{{ $value->qual_tp }}</td>
<td>{{ $value->pr_line_1 }}</td>
<td>{{ $value->pr_line_2 }}</td>
<td>{{ $value->pr_line_3 }}</td>
<td>{{ $value->pr_line_4 }}</td>
<td>{{ $value->pr_line_5 }}</td>
<td>{{ $value->pr_line_6 }}</td>
<td>{{ $value->getFormattedGrowthBonus() }}</td>
<td data-sort="{{ $value->active }}">{!! get_active_badge($value->active) !!}</td>
<td data-sort="{{ $value->default }}">{!! get_active_badge($value->default) !!}</td>
<td>{{ $value->id }}</td>
</tr>
@endforeach
</tbody>
@ -53,97 +73,13 @@
</div>
<!-- Modal template -->
<div class="modal fade" id="modals-default">
<div class="modal-dialog">
<form class="modal-content" action="{{ route('admin_level_store') }}" method="post">
@csrf
<input type="hidden" class="form-control" name="id">
<div class="modal-header">
<h5 class="modal-title"> {{__('Attribute')}} <span class="font-weight-light">{{__('create/edit')}}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col">
<label for="name" class="form-label">{{__('Name')}}</label>
<input type="text" class="form-control" name="name" placeholder="{{__('Bezeichnung')}}">
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="margin" class="form-label">{{__('Marge in %')}}</label>
<input type="text" class="form-control" name="margin" placeholder="{{__('Marge in %')}}">
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label class="custom-control custom-checkbox m-2">
<input type="checkbox" class="custom-control-input" name="active" checked>
<span class="custom-control-label">{{__('active')}}</span>
</label>
</div>
<div class="form-group col-6">
<input type="text" class="form-control" name="pos" placeholder="{{__('Number to move the position if necessary')}}">
</div>
</div>
<hr>
@foreach($trans as $tran)
@if($tran != 'de')
<div class="form-row">
<div class="form-group col">
<label for="name" class="form-label">{{__('Translate')}} <strong style="text-transform: uppercase">{{$tran}}</strong></label>
<input type="text" class="form-control" name="trans[{{$tran}}]" id="trans_{{$tran}}" placeholder="">
</div>
</div>
@endif
@endforeach
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
<button type="submit" class="btn btn-primary">{{__('save')}}</button>
</div>
</form>
</div>
</div>
<script>
$( document ).ready(function() {
$('#modals-default').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
$(this).find(".modal-content input[name='id']").val(button.data('id'));
$(this).find(".modal-body input[name='name']").val(button.data('name'));
$(this).find(".modal-body input[name='pos']").val(button.data('pos'));
$(this).find(".modal-body input[name='margin']").val(button.data('margin'));
$(this).find(".modal-body input[name='active']").prop( "checked", button.data('active'));
$.each(button.data('trans_name'), function (i, item) {
var name = '#trans_'+i;
$(name).val(item);
});
});
$('.datatables-style').dataTable({
"bLengthChange": false,
"iDisplayLength": 50,
"aoColumns": [
{ "sWidth": "8%" },
{ "sWidth": "8%" },
{ "sWidth": "19%" },
{ "sWidth": "19%" },
{ "sWidth": "30%" },
{ "sWidth": "10%" },
{ "sWidth": "8%" },
],
"order": [[ 1, "asc" ]],
"language": {
"url": "/js/German.json"
}

View file

@ -0,0 +1,162 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{__('Business')}} {{__('Berater')}}<br>
@if(isset($user))
<span class="font-weight-light">{{ $user->account->first_name }} {{ $user->account->last_name }} <a class="font-weight-normal" href="mailto:{{ $user->email }}">{{ $user->email }}</a></span>
@endif
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
@if(isset($TreeCalcBot))
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Account ID:</td>
<td>{{ $user->account->m_account }}</td>
</tr>
<tr>
<td>Level:</td>
<td>
@if($user->user_level)
{{ $user->user_level->name }}
@else
-
@endif
</td>
</tr>
<tr>
<td>Kundenprovision:</td>
<td>
{{ $TreeCalcBot->user->margin }} %
</td>
</tr>
<tr>
<td>Shop Provision:</td>
<td>
{{ $TreeCalcBot->user->margin_shop }} %
</td>
</tr>
<tr>
<td>Account:</td>
<td>
@if($user->isActiveAccount())
<span class="badge badge-outline-success">aktiv</span>
@else
<span class="badge badge-outline-danger">nicht aktiv</span>
@endif
@if($user->payment_account)
bis: {{ $user->getPaymentAccountDateFormat(false) }}
@endif
</td>
</tr>
<tr>
<td>Sponsor:</td>
<td>@if($user->user_sponsor)
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->first_name }} {{ $user->user_sponsor->account->last_name }} |
@endif
{{ $user->user_sponsor->email }} |
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->m_account }} |
@endif
{{-- <a href="{{ route('admin_business_user_detail', [$user->user_sponsor->id]) }}" class="btn icon-btn btn-xs btn-secondary"><span class="far fa-calculator"></span></a> --}}
@else
-
@endif
</td>
</tr>
<tr>
<td>Datum:</td>
<td><strong>{{ HTMLHelper::getMonth($data['month']) }} {{ $data['year'] }}</strong></td>
</tr>
<tr>
<td>Points:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_points_sum }}</strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_points }} | Shop: {{ $TreeCalcBot->user->sales_volume_points_shop }}
</td>
</tr>
<tr>
<td>Umsatz:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_total_sum }} </strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_total }} | Shop: {{ $TreeCalcBot->user->sales_volume_total_shop }}
</td>
</tr>
<tr>
<td>Persönliches Volumen:</td>
<td>
<span class="badge {{ $TreeCalcBot->user->isQualKP() ? 'badge-outline-success' : 'badge-outline-danger' }}"> KD {{ $TreeCalcBot->user->qual_kp }}</span>
</td>
</tr>
<tr>
<td>Qualifikation:</td>
<td>
TP {{ formatNumber($TreeCalcBot->user->qual_tp, 0) }} /
@if($TreeCalcBot->user->isQualKP())
<strong> TP {{ formatNumber($TreeCalcBot->total_qual_tp, 0) }}</strong> &nbsp;
@if($TreeCalcBot->qual_user_level)
<span class="badge badge-outline-success">{{ formatNumber($TreeCalcBot->qual_user_level->qual_tp, 0) }} | {{ $TreeCalcBot->qual_user_level->name }}</span>
@endif
@else
<span class="ion ion-md-close text-danger"></span>
@endif
</td>
</tr>
</tbody>
</table>
<hr class="border-light m-0">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>Linie</th>
<th>Points</th>
<th>Provision</th>
<th>Provision</th>
</tr>
@for ($line=1; $line<=6; $line++)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }}</td>
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td>Gesamt</td>
<td>{{ formatNumber($TreeCalcBot->total_tp, 0) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->commission_total, 2) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
</div>
<script>
$( document ).ready(function() {
});
</script>
</div>

View file

@ -77,8 +77,5 @@
</script>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
</div>
</div>

View file

@ -0,0 +1,119 @@
{!! Form::open(['url' => $route, 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}
<div class="modal-header">
<h5 class="modal-title">
{{ __('Berater') }} Karriere-Level
<span class="font-weight-light">bearbeiten</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="{{$data['action']}}">
<input type="hidden" name="id" value="{{$data['id']}}">
<input type="hidden" name="view" value="{{$data['view']}}">
<div class="form-row">
<div class="form-group col-12">
<label class="custom-control custom-checkbox float-right">
{!! Form::checkbox('active', 1, $value->active, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">{{__('aktiv')}}</span>
</label>
<label for="name" class="form-label">{{__('Bezeichnung')}} </label>
{{ Form::text('name', $value->name, array('placeholder'=>__('Bezeichnung'), 'class'=>'form-control', 'id'=>'name')) }}
</div>
<div class="form-group col-12">
<label for="next_id" class="form-label">{{ __('Nächster Karriere-Level') }}*</label>
{{ Form::select('next_id', $value->getNextUserLevels(), $value->next_id, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'next_id') ) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-6">
<label for="margin" class="form-label">{{__('Kundenprovision in %')}}</label>
{{ Form::text('margin', $value->margin, array('placeholder'=>__('Marge in %'), 'class'=>'form-control', 'id'=>'margin')) }}
</div>
<div class="form-group col-sm-6">
<label for="margin_shop" class="form-label">{{__('Shop Provision in %')}}</label>
{{ Form::text('margin_shop', $value->margin_shop, array('placeholder'=>__('Marge in %'), 'class'=>'form-control', 'id'=>'margin_shop')) }}
</div>
<div class="form-group col-sm-6">
<label for="qual_kp" class="form-label">{{__('Persönliches Volumen')}} {{__('Kundenpoints')}}</label>
{{ Form::text('qual_kp', $value->qual_kp, array('placeholder'=>__('Kundenpoints'), 'class'=>'form-control', 'id'=>'qual_kp')) }}
</div>
<div class="form-group col-sm-6">
<label for="qual_tp" class="form-label">{{__('Qualifikation')}} {{__('Team-Points')}}</label>
{{ Form::text('qual_tp', $value->qual_tp, array('placeholder'=>__('Team-Points'), 'class'=>'form-control', 'id'=>'qual_tp')) }}
</div>
<div class="form-group col-sm-12">
<label for="growth_bonus" class="form-label">{{__('Wachstumsbonus in %')}} </label>
{{ Form::text('growth_bonus', $value->getFormattedGrowthBonus(), array('placeholder'=>__('Wachstumsbonus in %'), 'class'=>'form-control', 'id'=>'growth_bonus')) }}
</div>
</div>
<hr>
<h6>{{__('Provision Team')}}</h6>
<div class="form-row">
<div class="form-group col-sm-4">
<label for="pr_line_1" class="form-label">1 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_1', $value->pr_line_1, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_1')) }}
</div>
<div class="form-group col-sm-4">
<label for="pr_line_2" class="form-label">2 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_2', $value->pr_line_2, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_2')) }}
</div>
<div class="form-group col-sm-4">
<label for="pr_line_3" class="form-label">3 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_3', $value->pr_line_3, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_3')) }}
</div>
<div class="form-group col-sm-4">
<label for="pr_line_4" class="form-label">4 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_4', $value->pr_line_4, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_4')) }}
</div>
<div class="form-group col-sm-4">
<label for="pr_line_5" class="form-label">5 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_5', $value->pr_line_5, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_5')) }}
</div>
<div class="form-group col-sm-4">
<label for="pr_line_6" class="form-label">6 {{__('Ebene in %')}} </label>
{{ Form::text('pr_line_6', $value->pr_line_6, array('placeholder'=>__('Ebene 1'), 'class'=>'form-control', 'id'=>'pr_line_6')) }}
</div>
</div>
<hr>
<div class="form-row">
<div class="form-group col-sm-6">
<label for="pos" class="form-label">{{__('Pos')}} {{__('Sortierung')}} </label>
{{ Form::text('pos', $value->pos, array('placeholder'=>__('Pos'), 'class'=>'form-control', 'id'=>'pos')) }}
</div>
<div class="form-group col-sm-6">
<label for="default" class="form-label">&nbsp;</label>
<label class="custom-control custom-checkbox">
{!! Form::checkbox('default', 1, $value->default, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Wird als Standard bei Neuregistrierungen gesetzt.</span>
</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
<button type="submit" class="btn btn-primary">{{__('übernehmen')}}</button>
</div>
{!! Form::close() !!}
<script type="text/javascript">
$( document ).ready(function() {
});
</script>

View file

@ -2,11 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
Finanzen / Rechnungen
</h6>
</h5>
<div class="card-body p-0">
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_payment_invoices']) !!}

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Zahlungsarten')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -0,0 +1,353 @@
<div class="card mb-2">
<h5 class="card-header">
{{ __('Produkt') }}
</h5>
<div class="card-body">
<div class="form-group">
<label class="custom-control custom-checkbox float-right">
{!! Form::checkbox('active', 1, $product->active, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">{{__('aktiv')}}</span>
</label>
<label class="form-label" for="name">{{ __('Produktname / Titel') }}*</label>
{{ Form::text('name', $product->name, array('placeholder'=>__('Name'), 'class'=>'form-control', 'id'=>'name', 'required')) }}
</div>
<div class="form-row">
<div class="form-group col-sm-6">
<label class="form-label" for="number">{{ __('Artikelnummer') }}</label>
{{ Form::text('number', $product->number, array('placeholder'=>__('number'), 'class'=>'form-control', 'id'=>'number')) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="ean">{{ __('EAN') }}</label>
{{ Form::text('ean', $product->ean, array('placeholder'=>__('EAN'), 'class'=>'form-control', 'id'=>'ean')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-10">
<label class="form-label" for="title">{{ __('Kategorie (Mehrfachauswahl)') }}*</label>
<select class="selectpicker" name="categories[]" id="categories" data-style="btn-light" data-live-search="false" multiple required>
{!! HTMLHelper::getCategoriesOptions($product->categories()->pluck('category_id')->toArray(), false) !!}
</select>
</div>
{{--
<div class="form-group col-sm-5">
<label class="form-label" for="show_at">{{ __('Produkt anzeigen') }} alt</label>
{{ Form::select('show_at', $product->showATs, $product->show_at, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_at') ) }}
</div>
--}}
<div class="form-group col-sm-2">
<label class="form-label" for="pos">{{ __('Listenposition') }}</label>
{{ Form::text('pos', $product->pos, array('placeholder'=>__('1, 2, 3, etc'), 'class'=>'form-control', 'id'=>'pos')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-10">
<label class="form-label" for="show_on">{{ __('Produkt anzeigen (Mehrfachauswahl)') }}</label>
{{ Form::select('show_on[]', $product->showONs, $product->show_on, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'show_on', 'multiple') ) }}
</div>
</div>
<div class="form-group">
<label class="form-label" for="copy">{{ __('Produktbeschreibung') }}</label>
{{ Form::textarea('copy', $product->copy , array('placeholder'=>__('Produktbeschreibung'), 'class'=>'form-control summernote', 'id'=>'copy')) }}
</div>
<label class="custom-control custom-checkbox float-right">
{!! Form::checkbox('shipping_addon', 1, $product->shipping_addon, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Kompensationprodukt beim Versand für Berater</span>
</label>
</div>
</div>
<div class="card mb-2">
<h5 class="card-header">
{{ __('Preise in EUR') }}
</h5>
<div class="card-body">
<div class="form-row">
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="price">{{ __('Preis VK in EUR (Brutto)') }}</label>
{{ Form::text('price', $product->getFormattedPrice(), array('placeholder'=>__('Preis VK in EUR (Brutto)'), 'class'=>'form-control', 'id'=>'price')) }}
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="price_ek">{{ __('Preis EK in EUR') }}</label>
{{ Form::text('price_ek', $product->getFormattedPriceEk(), array('placeholder'=>__('Preis EK in EUR'), 'class'=>'form-control', 'id'=>'price_ek')) }}
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="tax">{{ __('MwSt in %') }}</label>
{{ Form::text('tax', $product->getFormattedTax(), array('placeholder'=>__('MwSt in %'), 'class'=>'form-control', 'id'=>'tax')) }}
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="price_old">{{ __('Streichpreis in EUR (wenn > 0)') }}</label>
{{ Form::text('price_old', $product->getFormattedPriceOld(), array('placeholder'=>__('Streichpreis'), 'class'=>'form-control', 'id'=>'price_old')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-4">
<label class="form-label" for="weight">{{ __('Gewicht in g') }}</label>
{{ Form::text('weight', $product->weight, array('placeholder'=>__('Gewicht in g'), 'class'=>'form-control', 'id'=>'weight')) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="points">{{ __('Points pro Produkt') }}</label>
{{ Form::text('points', $product->points, array('placeholder'=>__('Points pro Produkt'), 'class'=>'form-control', 'id'=>'points')) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="amount">{{ __('Anzahl/Verfügbarkeit') }}</label>
{{ Form::text('amount', $product->amount, array('placeholder'=>__('Anzahl/Verfügbarkeit'), 'class'=>'form-control', 'id'=>'amount')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="form-label">Keine Provision</label>
<label class="custom-control custom-checkbox">
{!! Form::checkbox('no_commission', 1, $product->no_commission, ['class'=>'custom-control-input', 'id'=>'no_commission']) !!}
<span class="custom-control-label">Dieses Produkt ist nicht provisionsfähig.</span>
</label>
</div>
</div>
</div>
</div>
<div class="card mb-2">
<h5 class="card-header">
Landesspezifische Preise
</h5>
<div class="card-body pt-0">
@foreach($country_for_prices as $country)
{{ Form::hidden('country_prices[]', $country->id) }}
<div class="card-header bg-light pb-0 mt-3">
<h6>{{$country->de}}</h6>
</div>
<div class="bg-lighter p-2">
@if($country->own_eur)
<div class="form-row">
<div class="form-group col-sm-4 col-md-3">
<label class="form-label">Land hat eigenen EURO Preis</label>
<p></p>
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="price">{{ __('Preis VK in EUR Brutto') }}</label>
{{ Form::text('c_price['.$country->id.']', formatNumber($product->getCPrice($country)), array('placeholder'=>__('Preis VK in EUR Brutto'), 'class'=>'form-control', 'id'=>'c_price_'.$country->id)) }}
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="tax">{{ __('MwSt in %') }}</label>
{{ Form::text('c_tax['.$country->id.']', formatNumber($product->getCTax($country)), array('placeholder'=>__('MwSt in %'), 'class'=>'form-control', 'id'=>'c_tax'.$country->id)) }}
</div>
<div class="form-group col-sm-4 col-md-3">
<label class="form-label" for="price_old">{{ __('Streichpreis (wenn > 0)') }}</label>
{{ Form::text('c_price_old['.$country->id.']', formatNumber($product->getCPriceOld($country)), array('placeholder'=>__('Streichpreis'), 'class'=>'form-control', 'id'=>'c_price_old'.$country->id)) }}
</div>
</div>
@endif
@if($country->currency)
<div class="form-row">
<div class="form-group col-sm-4 col-md-3">
<label class="form-label">Land hat eigene Währung</label>
<p>@if($country->currency_calc) Preis Berechnung automatisch @else Preis manuell
angegeben @endif</p>
</div>
{{-- NUR Anzeige vom automatisch berechneten Preis currency_faktor
Auf Basis vom price
Wenn own_eur auf basis vom own_eur price
--}}
<div class="form-group col-sm-4 col-md-3">
<label class="form-label">Preis VK in {{ $country->currency_unit }}</label>
{{ Form::text('c_currency['.$country->id.']', formatNumber($product->getRealPrice($country) * $country->currency_faktor), array('class'=>'form-control', 'readonly')) }}
</div>
{{--@if($country->currency_calc)
@else
Eingabe
Währungs Namen aus currency_name
currency_faktor als Hinweis ausgeben
Auf Basis vom price
Wenn own_eur auf basis vom own_eur price
<div class="form-group col-sm-4 col-md-3">
<label class="form-label">{{__('Preis VK in ')}} {{ $country->currency_unit }} ({{formatNumber($product->getRealPrice($country) * $country->currency_faktor)}})</label>
{{ Form::text('c_currency['.$country->id.']', formatNumber($product->getCCurrency($country->id)), array('placeholder'=>__('Preis VK in ').$country->currency_unit, 'class'=>'form-control')) }}
</div>
@endif --}}
<div class="form-group col-sm-4 col-md-2">
<label class="form-label">{{ __('Währungs Faktor' ) }}</label>
{{ Form::text('currency_faktor['.$country->id.']', formatNumber($country->currency_faktor, 4), array('class'=>'form-control', 'readonly')) }}
</div>
<div class="form-group col-sm-4 col-md-2">
<label class="form-label">{{ __('Preis VK in EUR ') }}</label>
{{ Form::text('preis_eur['.$country->id.']', formatNumber($product->getRealPrice($country)), array('class'=>'form-control', 'readonly')) }}
</div>
<div class="form-group col-sm-4 col-md-2">
<label class="form-label">{{ __('Währung') }}</label>
{{ Form::text('currency_unit['.$country->id.']', $country->currency_unit, array('class'=>'form-control', 'readonly')) }}
</div>
</div>
@endif
</div>
@endforeach
<em class="float-right text-muted small">für die Einstellung von landesspezifischen Preisen müssen diese unter
<a href="{{route('admin_countries')}}">Länder</a> -> Land aktiviert werden.</em>
</div>
</div>
<div class="card mb-2">
<h5 class="card-header">
{{ __('Details') }}
</h5>
<div class="card-body">
<div class="form-row">
<div class="form-group col-sm-5">
<label class="form-label" for="contents">{{ __('Menge Inhalt (ml / g) als Text') }}</label>
{{ Form::text('contents', $product->contents, array('placeholder'=>__('Bsp: 150 ml'), 'class'=>'form-control', 'id'=>'contents')) }}
</div>
<div class="form-group col-sm-3">
<label class="form-label" for="contents_total">{{ __('Gesamter Inhalt (ml / g) als Zahl') }}</label>
{{ Form::text('contents_total', $product->contents_total, array('placeholder'=>__('Bsp: 150'), 'class'=>'form-control', 'id'=>'contents_total')) }}
</div>
<div class="form-group col-sm-2">
<label class="form-label" for="contents">{{ __('Grundpreis Einheit') }}</label>
{{ Form::select('unit', $product->unitTypes, $product->unit, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'unit') ) }}
</div>
<div class="form-group col-sm-2">
<label class="form-label" for="base_price">{{ __('Grundpreis') }}</label>
{{ Form::text('base_price', $product->getBasePriceFormattedFull(), array('placeholder'=>__(''), 'class'=>'form-control', 'id'=>'base_price', 'readonly')) }}
</div>
{{-- <div class="form-group col-sm-4">
<label class="form-label" for="title">{{ __('Attribute') }}</label>
<select class="selectpicker" name="attributes[]" id="attributes" data-style="btn-light"
data-live-search="false" multiple>
{!! HTMLHelper::getAttributesOptions($product->attributes()->pluck('attribute_id')->toArray()) !!}
</select>
</div>
--}}
</div>
<div class="form-group">
<label class="form-label" for="description">{{ __('Beschreibung') }}</label>
{{ Form::textarea('description', $product->description , array('placeholder'=>__('description'), 'class'=>'form-control summernote', 'id'=>'description')) }}
</div>
<div class="form-group">
<label class="form-label" for="usage">{{ __('Anwendung') }}</label>
{{ Form::textarea('usage', $product->usage , array('placeholder'=>__('usage'), 'class'=>'form-control summernote', 'id'=>'usage')) }}
</div>
<div class="form-group">
<label class="form-label" for="ingredients">{{ __('Hinweise') }}</label>
{{ Form::textarea('ingredients', $product->ingredients , array('placeholder'=>__('ingredients'), 'class'=>'form-control summernote', 'id'=>'ingredients')) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="icons">{{ __('Icons') }}</label>
{{ Form::text('icons', $product->icons, array('placeholder'=>__('icons'), 'class'=>'form-control', 'id'=>'icons')) }}
"product_icons_1.png"
</div>
</div>
</div>
<div class="card mb-2">
<h5 class="card-header">
{{ __('Inhalte') }}
</h5>
<div class="card-body">
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th>{{__('Name')}}</th>
<th>{{__('INCI')}}</th>
<th>{{__('Wirkung') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($product->p_ingredients as $ingredient)
<tr>
<td>{{ $ingredient->name }}</td>
<td>{{ $ingredient->inci }}</td>
<td>{{ $ingredient->effect }}</td>
<td><a class="text-danger" href="{{ route('admin_product_delete', [$product->id, 'ingredient', $ingredient->id]) }}" onclick="return confirm('{{__('Eintrag entfernen?')}}');"><i class="far fa-trash-alt"></i></a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="form-row">
<div class="form-group col-sm-10">
<label class="form-label" for="title">{{ __('Inhaltsstoffe hinzufügen (Mehrfachauswahl)') }}</label>
<select class="selectpicker" name="product_ingredients[]" id="product_ingredients" data-style="btn-light" data-live-search="false" multiple>
{!! HTMLHelper::getProductIngredientsOptions($product->p_ingredients()->pluck('ingredient_id')->toArray()) !!}
</select>
<a class="btn btn-default btn-xs mt-2" href="{{route('admin_product_ingredients')}}">Inhaltsstoffe anlegen</a>
</div>
<div class="form-group col-sm-2">
<button type="submit" class="btn btn-submit mt-0 mt-sm-4">{{ __('save') }}</button>&nbsp;
</div>
</div>
</div>
</div>
@if(Auth::user()->isSuperAdmin())
<div class="card mb-2">
<h5 class="card-header">
{{ __('SuperAdmin Einstellungen') }}
</h5>
<div class="card-body">
<div class="form-row">
<div class="form-group col-sm-6">
<label class="form-label" for="action">{{ __('Aktion beim Zahlungsprozess') }}</label>
{{ Form::select('action[]', $product->actionNames, $product->action, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'action', 'multiple') ) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="identifier">{{ __('Anzeigeoptionen Zahlung Mitglieder-Accounts') }}</label>
{{ Form::select('identifier', $product->identifiers_types, $product->identifier, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'identifier') ) }}
</div>
<div class="form-group col-sm-2">
<label class="form-label" for="upgrade_to_id">{{ __('Bei Upgrade auf ID') }}</label>
{{ Form::text('upgrade_to_id', $product->upgrade_to_id, array('placeholder'=>__('Upgrade-ID'), 'class'=>'form-control', 'id'=>'upgrade_to_id')) }}
</div>
<div class="form-group col-sm-6">
@if($product->action && is_array($product->action))
@foreach ($product->action as $do )
@if($product->getActionName($do) === 'payment_for_shop_upgrade')
<label class="form-label" for="">{{ __('Upgrade auf das Produkt') }} <span class="small">(Wird nach dem Speichern aktualisiert)</span></label>
<div class="mt-2"><strong>{{ $product->getUpgradeToIdName('payment_for_shop_upgrade') }}</strong>
</div>
@endif
@if($product->getActionName($do) === 'payment_for_lead_upgrade')
<label class="form-label" for="">{{ __('Upgrade auf Karriere Level') }} <span class="small">(Wird nach dem Speichern aktualisiert)</span></label>
<div class="mt-2"><strong>{{ $product->getUpgradeToIdName('payment_for_lead_upgrade') }}</strong>
@endif
@endforeach
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-5">
<label class="form-label" for="wp_number">WP Artikel Number (als Zahl ohne Leerzeichen für die WP-API)</label>
{{ Form::text('wp_number', $product->wp_number, array('placeholder'=>__('WP Number'), 'class'=>'form-control', 'id'=>'wp_number')) }}
</div>
</div>
</div>
</div>
@endif

71
resources/views/admin/product/form.blade.php Executable file → Normal file
View file

@ -17,11 +17,16 @@
{{ Form::text('name', $product->name, array('placeholder'=>__('Name'), 'class'=>'form-control', 'id'=>'name', 'required')) }}
</div>
<div class="form-row">
{{-- <div class="form-group col-sm-6">
<label class="form-label" for="title">{{ __('Title') }}</label>
{{ Form::text('title', $product->title, array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'title')) }}
<div class="form-group col-sm-6">
<label class="form-label" for="number">{{ __('Artikelnummer') }}</label>
{{ Form::text('number', $product->number, array('placeholder'=>__('number'), 'class'=>'form-control', 'id'=>'number')) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="ean">{{ __('EAN Code') }}</label>
{{ Form::text('ean', $product->ean, array('placeholder'=>__('EAN'), 'class'=>'form-control', 'id'=>'ean')) }}
</div>
--}}
</div>
<div class="form-row">
@ -207,7 +212,7 @@
<div class="card mb-2">
<h5 class="card-header">
{{ __('Inhalte') }}
{{ __('Details') }}
</h5>
<div class="card-body">
<div class="form-row">
@ -227,25 +232,15 @@
<div class="form-group col-sm-2">
<label class="form-label" for="base_price">{{ __('Grundpreis') }}</label>
{{ Form::text('base_price', $product->getBasePriceFormattedFull(), array('placeholder'=>__(''), 'class'=>'form-control', 'id'=>'base_price', 'readonly')) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="number">{{ __('Artikelnummer') }}</label>
{{ Form::text('number', $product->number, array('placeholder'=>__('number'), 'class'=>'form-control', 'id'=>'number')) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="icons">{{ __('Icons') }}</label>
{{ Form::text('icons', $product->icons, array('placeholder'=>__('icons'), 'class'=>'form-control', 'id'=>'icons')) }}
</div>
<div class="form-group col-sm-4">
{{-- <div class="form-group col-sm-4">
<label class="form-label" for="title">{{ __('Attribute') }}</label>
<select class="selectpicker" name="attributes[]" id="attributes" data-style="btn-light"
data-live-search="false" multiple>
{!! HTMLHelper::getAttributesOptions($product->attributes()->pluck('attribute_id')->toArray()) !!}
</select>
</div>
--}}
</div>
<div class="form-group">
@ -260,6 +255,18 @@
<label class="form-label" for="ingredients">{{ __('Hinweise') }}</label>
{{ Form::textarea('ingredients', $product->ingredients , array('placeholder'=>__('ingredients'), 'class'=>'form-control summernote', 'id'=>'ingredients')) }}
</div>
<div class="form-row">
<div class="form-group col-sm-6">
<label class="form-label" for="icons">{{ __('Produkt Icon') }}</label>
{{ Form::select('icons', [null=>'Kein Icon', 'product_icons_1.png'=>'product_icons_1.png','product_icons_2.jpg'=>'product_icons_2.jpg'], $product->icons, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'icons') ) }}
</div>
<div class="form-group col-sm-6">
<img src="/assets/images/{{ $product->icons }}" alt="" class="img-responsive" width="200">
</div>
</div>
</div>
</div>
@ -305,24 +312,40 @@
</div>
</div>
@if(Auth::user()->isSySAdmin())
@if(Auth::user()->isSuperAdmin())
<div class="card mb-2">
<h5 class="card-header">
{{ __('SySAdmin Einstellungen') }}
{{ __('SuperAdmin Einstellungen') }}
</h5>
<div class="card-body">
<div class="form-row">
<div class="form-group col-sm-5">
<div class="form-group col-sm-6">
<label class="form-label" for="action">{{ __('Aktion beim Zahlungsprozess') }}</label>
{{ Form::select('action[]', $product->actions, $product->action, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'action', 'multiple') ) }}
{{ Form::select('action[]', $product->actionNames, $product->action, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'action', 'multiple') ) }}
</div>
<div class="form-group col-sm-5">
<div class="form-group col-sm-6">
<label class="form-label" for="identifier">{{ __('Anzeigeoptionen Zahlung Mitglieder-Accounts') }}</label>
{{ Form::select('identifier', $product->identifiers_types, $product->identifier, array('data-live-search'=>'false', 'class'=>'selectpicker', 'id'=>'identifier') ) }}
</div>
<div class="form-group col-sm-2">
<label class="form-label" for="upgrade_to_id">{{ __('Bei Upgrade auf Produkt-ID') }}</label>
{{ Form::text('upgrade_to_id', $product->upgrade_to_id, array('placeholder'=>__('Produkt-ID auf das geupdatet werden soll'), 'class'=>'form-control', 'id'=>'upgrade_to_id')) }}
<label class="form-label" for="upgrade_to_id">{{ __('Bei Upgrade auf ID') }}</label>
{{ Form::text('upgrade_to_id', $product->upgrade_to_id, array('placeholder'=>__('Upgrade-ID'), 'class'=>'form-control', 'id'=>'upgrade_to_id')) }}
</div>
<div class="form-group col-sm-6">
@if($product->action && is_array($product->action))
@foreach ($product->action as $do )
@if($product->getActionName($do) === 'payment_for_shop_upgrade')
<label class="form-label" for="">{{ __('Upgrade auf das Produkt') }} <span class="small">(Wird nach dem Speichern aktualisiert)</span></label>
<div class="mt-2"><strong>{{ $product->getUpgradeToIdName('payment_for_shop_upgrade') }}</strong>
</div>
@endif
@if($product->getActionName($do) === 'payment_for_lead_upgrade')
<label class="form-label" for="">{{ __('Upgrade auf Karriere Level') }} <span class="small">(Wird nach dem Speichern aktualisiert)</span></label>
<div class="mt-2"><strong>{{ $product->getUpgradeToIdName('payment_for_lead_upgrade') }}</strong>
@endif
@endforeach
@endif
</div>
</div>
<div class="form-row">

View file

@ -3,13 +3,13 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Produkte')}}
<label class="custom-control custom-checkbox float-right mb-0">
<input type="checkbox" class="custom-control-input show-active-products" name="show_active_products" @if(get_user_attr('show_active_products') === "true") checked @endif>
<span class="custom-control-label font-style-normal font-weight-normal">nur aktive anzeigen</span>
</label>
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-product table table-striped table-bordered">
<thead>

View file

@ -43,7 +43,8 @@
</button>
@endif
@else
{{--
@if(Auth::user()->isSySAdmin())
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-invoice"
data-id="{{ $shopping_order->id }}"
//TODO
@ -52,7 +53,7 @@
data-action="create_invoice">
<span class="fa fa-file"></span> <strong>Rechnung erstellen</strong>
</button>
--}}
@endif
@endif
@else
@if($shopping_order->isInvoice())

View file

@ -60,9 +60,9 @@
@if($value->id>0)
<div class="card mb-2">
<h6 class="card-header">
<h5 class="card-header">
{{__('Preise')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
@ -195,9 +195,9 @@
</div>
<div class="card mb-2">
<h6 class="card-header">
<h5 class="card-header">
{{__('Land')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<tbody>

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Versandkosten')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -566,7 +566,7 @@
@if($shopping_order->member)
Berater: {{ \App\Services\HTMLHelper::getSalutationLang($shopping_order->member->account->m_salutation) }} {{ $shopping_order->member->account->m_first_name }} {{ $shopping_order->member->account->m_last_name }}
<br>
Account ID: {{ $shopping_order->member->account->m_account }} <br>
Berater-ID: {{ $shopping_order->member->account->m_account }} <br>
@if($shopping_order->member->user_level)
Karriere-Level: {{ $shopping_order->member->user_level->name }} <br>
@endif

View file

@ -149,7 +149,6 @@
<div class="card-header-title">{{__('Mitgliedschaft') }}</div>
</h5>
<div class="card-body">
@if($user->isActiveAccount() )
<div class="badge btn-success p-2">
<i class="ion ion-md-checkmark-circle-outline text-white"></i>

View file

@ -13,7 +13,6 @@
</li>
@if(Auth::user()->showSideNav())
<li class="sidenav-item @if(Request::is('user/edit', 'user/membership')) open @endif">
<a href="javascript:void(0)" class="sidenav-link sidenav-toggle">
<i class="sidenav-icon ion ion-ios-contact"></i>
@ -52,8 +51,11 @@
<div>{{ __('navigation.my_team') }}</div>
</a>
<ul class="sidenav-menu">
<li class="sidenav-item{{ Request::is('user/team/structure') ? ' active' : '' }}">
<a href="{{ route('user_team_structure') }}" class="sidenav-link"><i class="sidenav-icon ion ion ion-md-funnel rotate-180" style="text-align: right"></i><div>{{ __('navigation.structure') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('user/team/members') ? ' active' : '' }}">
<a href="{{ route('user_team_members') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-person-add"></i><div>{{ __('navigation.member') }}</div></a>
<a href="{{ route('user_team_members') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-person-add"></i><div>neuen {{ __('navigation.member') }}</div></a>
</li>
</ul>
</li>
@ -146,6 +148,21 @@
</ul>
</li>
<li class="sidenav-item @if(Request::is('admin/business/*')) open @endif">
<a href="javascript:void(0)" class="sidenav-link sidenav-toggle">
<i class="sidenav-icon ion ion-md-business"></i>
<div>{{ __('navigation.business') }}</div>
</a>
<ul class="sidenav-menu">
<li class="sidenav-item{{ Request::is('admin/business/show') ? ' active' : '' }}">
<a href="{{ route('admin_business_show') }}" class="sidenav-link"><i class="sidenav-icon ion ion ion-md-list"></i><div>{{ __('navigation.overview') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('admin/business/structure', 'admin/business/structure/*') ? ' active' : '' }}">
<a href="{{ route('admin_business_structure') }}" class="sidenav-link"><i class="sidenav-icon ion ion ion-md-funnel rotate-180" style="text-align: right"></i><div>{{ __('navigation.structure') }}</div></a>
</li>
</ul>
</li>
<li class="sidenav-item @if(Request::is('admin/product/*')) open @endif">
<a href="javascript:void(0)" class="sidenav-link sidenav-toggle">
<i class="sidenav-icon ion ion-md-cube"></i>
@ -178,8 +195,8 @@
</li>
</ul>
</li>
{{-- --}}<li class="sidenav-item{{ Request::is('admin/translate/*') ? ' open' : '' }}">
{{--
<li class="sidenav-item{{ Request::is('admin/translate/*') ? ' open' : '' }}">
<a href="javascript:void(0)" class="sidenav-link sidenav-toggle">
<i class="sidenav-icon ion ion-ios-browsers"></i>
<div>{{ __('navigation.translate') }}</div>
@ -195,6 +212,7 @@
</li>
</ul>
</li>
--}}
@endif
@if(Auth::user()->isSuperAdmin())
@ -224,34 +242,8 @@
<li class="sidenav-divider mb-1"></li>
<li class="sidenav-header small font-weight-semibold">SYSADMIN</li>
<li class="sidenav-item{{ Request::is('sysadmin/tools/*') ? ' open' : '' }}">
<a href="javascript:void(0)" class="sidenav-link sidenav-toggle">
<i class="sidenav-icon ion ion-ios-settings"></i>
<div>Tools</div>
</a>
<ul class="sidenav-menu">
<li class="sidenav-item{{ Request::is('sysadmin/sales/members') ? ' active' : '' }}">
<a href="{{ route('sysadmin_sales_members') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-people"></i><div>Buchnungen Berater</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/tools/customers') ? ' active' : '' }}">
<a href="{{ route('sysadmin_tools_customers') }}" class="sidenav-link"><i class="sidenav-icon ion ion-md-contact"></i><div>Kunden</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/tools/cronjobs') ? ' active' : '' }}">
<a href="{{ route('sysadmin_tools_cronjobs') }}" class="sidenav-link"><i class="sidenav-icon ion ion-md-settings"></i><div>Cron Jobs</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/tools/domainssl') ? ' active' : '' }}">
<a href="{{ route('sysadmin_tools_domainssl') }}" class="sidenav-link"><i class="sidenav-icon ion ion-md-lock"></i><div>Domain SSL</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/tools/shopping_orders') ? ' active' : '' }}">
<a href="{{ route('sysadmin_tools_shopping_orders') }}" class="sidenav-link"><i class="sidenav-icon ion ion-md-analytics"></i><div>Shopping Orders</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/import') ? ' active' : '' }}">
<a href="{{ route('sysadmin_import') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-cloud-upload"></i><div>Import</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/points') ? ' active' : '' }}">
<a href="{{ route('sysadmin_points') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-pin"></i><div>Points</div></a>
</li>
</ul>
<li class="sidenav-item{{ Request::is('sysadmin/tools', 'sysadmin/tool/*') ? ' active' : '' }}">
<a href="{{ route('sysadmin_tools') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-cog"></i><div>Tools</div></a>
</li>
<li class="sidenav-item{{ Request::is('sysadmin/settings') ? ' active' : '' }}">
<a href="{{ route('sysadmin_settings') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-cog"></i><div>{{ __('navigation.system_settings') }}</div></a>

View file

@ -377,8 +377,23 @@
@if($shopping_order->tax == 0)
<br><span class="xsmall">* Preise netto</span>
@endif
</p>
@if($shopping_order->payment_for !== 6 && isset($shopping_order->shopping_user->auth_user))
<p>
@if(isset($shopping_order->shopping_user->auth_user->account->tax_identification_number))
USt-ID des Leistungsempfängers: {{ $shopping_order->shopping_user->auth_user->account->tax_identification_number }}<br>
@else
@if(isset($shopping_order->shopping_user->auth_user->account->tax_number))
USt-Nr. des Leistungsempfängers: {{ $shopping_order->shopping_user->auth_user->account->tax_number }}<br>
@endif
@endif
@if(isset($user_reverse_charge) && $user_reverse_charge)
<span class="xsmall">Die Rechnung erfolgt ohne Umsatzsteuer, da vorliegend der Wechsel der Steuerschuldnerschaft (Reverse-Charge-Verfahren) greift.<br>
Die Umsatzsteuer ist vom Leistungsempfänger anzumelden und abzuführen.</span>
@endif
</p>
@endif
@if($shopping_order->member)
<div class="dotted-line"></div>
<p>Bei Fragen sind wir jederzeit für Dich da.<br>

View file

@ -0,0 +1,20 @@
@extends('layouts.layout-2')
@section('content')
<div class="card mt-5">
<h5 class="card-header py-4 px-5">Sys Admin Tools</h5>
<div class="row no-gutters row-bordered">
<div class="col-md-12 p-5">
<a href="{{ route('sysadmin_tool', ['sales_members']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Buchnungen Pakete Berater nach Jahren</a>
<a href="{{ route('sysadmin_tool', ['customers']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Kundenhoheit prüfen</a>
<a href="{{ route('sysadmin_tool', ['cronjobs']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Cron Jobs</a>
<a href="{{ route('sysadmin_tool', ['domainssl']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Subdomains prüfen SSL/Aktiv</a>
<a href="{{ route('sysadmin_tool', ['shopping_orders']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Shopping Orders Käufe</a>
<a href="{{ route('sysadmin_tool', ['import']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Import</a>
<a href="{{ route('sysadmin_tool', ['corrections']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Corrections Points / Payment / Price / Tax / Tax Spit / Points / Discount </a>
</div>
</div>
</div>
@endsection

View file

@ -6,7 +6,7 @@
Berater Bestellungen
</h6>
<div class="col-sm-6 mb-2">
{!! Form::open(['url' => route('sysadmin_sales_members'), 'class' => 'form-horizontal', 'id'=>'filter_sales_member']) !!}
{!! Form::open(['url' => route('sysadmin_tool_store', ['sales_members']), 'class' => 'form-horizontal', 'id'=>'filter_sales_member']) !!}
<label class="form-label" for="filter_user_shop_id">Filter Jahr</label>
<select class="custom-select" name="filter_sales_year" id="filter_sales_year">

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card">
<h6 class="card-header">
<h5 class="card-header">
{{__('Systemeinstellungen')}}
</h6>
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>

View file

@ -0,0 +1,39 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold mb-4">
SysAdmin Cron Jobs
</h4>
<div class="card mb-4">
@if(count($values)>0)
<div class="card-body">
<!-- Controls -->
@foreach($values as $name=>$link)
<p>{{ $name }}</p>
<a href="{{$link}}" target="_blank">{{$link}}</a><hr><br><br>
@endforeach
</div>
@endif
</div>
@endsection

View file

@ -0,0 +1,75 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold mb-4">
SysAdmin Kundenhoheit prüfen
</h4>
{!! Form::open(['url' => route('sysadmin_tool_store', ['customers']), 'class' => '']) !!}
<div class="card mb-4">
{{-- <div class="card-body">
<!-- Controls -->
<button type="submit" name="action" value="checkForAll" class="btn btn-primary"><i class="ion"></i> checkForAll</button>
<button type="submit" name="action" value="makePaymentMethodsDefault" class="btn btn-primary"><i class="ion"></i> make PaymentMethods Default</button>
<button type="submit" name="action" value="checkContractPDF" class="btn btn-primary"><i class="ion"></i> check Contract PDF</button>
</div> --}}
@if(count($values)>0)
<div class="card-body">
<div class="card-datatable table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="max-width: 60px;">ID</th>
<th>{{__('Mail')}}</th>
<th>{{__('is like')}}</th>
<th>{{__('OrderID')}}</th>
<th>{{__('txaction')}}</th>
<th>{{__('Action')}}</th>
</tr>
</thead>
<tbody>
@foreach($values as $shopping_user)
<tr>
<td>{{$shopping_user->id}}</td>
<td>{{$shopping_user->billing_email}}</td>
<td>{{$shopping_user->is_like}}</td>
<td>@if($shopping_user->shopping_order){{$shopping_user->shopping_order->id}}@endif</td>
<td>@if($shopping_user->shopping_order){{$shopping_user->shopping_order->txaction}}@endif</td>
<td><button type="submit" name="action" value="checkOne_{{$shopping_user->id}}" class="btn btn-xs btn-primary"><i class="ion"></i> checkOne</button></td>
</tr>
@endforeach
</tbody>
</table>
<!-- Controls -->
</div>
</div>
@endif
</div>
{!! Form::close() !!}
@endsection

View file

@ -0,0 +1,186 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold mb-4">
Subdomains prüfen SSL/Aktiv
</h4>
<div class="card mb-4">
@if(count($SubDomains)>0)
{!! Form::open(['url' => route('sysadmin_tool_store', ['domainssl']), 'class' => '']) !!}
<div class="card-body">
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th>SubDomain</th>
<th>SSL</th>
<th>#</th>
</tr>
</thead>
<tbody>
@foreach($SubDomains as $SubDomain=>$ssl)
<tr>
<td><a href="{{ $SubDomain }}" target="_blank">{{ $SubDomain }}</a></td>
<td>{{ $ssl }}</td>
<td>
<button type="submit" class="btn btn-danger btn-xs" name="delete_sub_kas" value="{{ $SubDomain }}"><i class="ion"></i> löschen</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{!! Form::close() !!}
@endif
@if(count($values)>0)
{!! Form::open(['url' => route('sysadmin_tool_store', ['domainssl']), 'class' => '']) !!}
<div class="card-body">
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th style="max-width: 60px;">ID</th>
<th style="max-width: 60px;">User-ID</th>
<th>Domain</th>
<th>Sub</th>
<th>SSL</th>
<th>seit</th>
<th>Datum</th>
<th>Erreichbar</th>
<th>Status</th>
<th>User Account</th>
<th>User Shop</th>
<th>User seit</th>
<th>#</th>
</tr>
</thead>
<tbody>
@foreach($values as $value)
<tr>
<td>{{ $value->id }}</td>
<td>{{ $value->user_id }}</td>
<td><a href="https://{{ $value->slug }}.mivita.care" target="_blank">{{ $value->slug }}.mivita.care</a></td>
<td> {!! get_active_badge($value->hasSubdomain) !!} </td>
<td> {!! get_active_badge($value->hasSSL) !!} </td>
<td>{{ $value->getActiveDateFormatSmall() }}</td>
<td>
@if($value->user && $value->user->payment_shop)
@if($value->user->isActiveShop())
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> {{ $value->user->getPaymentShopDateFormat() }}</span>
@else
<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i>{{ $value->user->getPaymentShopDateFormat() }}</span></a>
@endif
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>
@endif
</td>
<td>
--
{{--
@if($value->getSubdomainAvailable())
<span class="badge badge-pill badge-success"><i class="fa fa-check"> {{ __('available') }} </i>
@if($value->getSubdomainSslSin()) HTTPS @else HTTP @endif
</span>
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"> {{ __('not available') }} </i> HTTP </span>
@endif
--}}
</td>
<td>{!! get_active_badge($value->active) !!}</td>
<td>@if($value->user)
@if($value->user->payment_account)
@if($value->user->isActiveAccount())
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> {{ $value->user->getPaymentAccountDateFormat() }}</span></a>
@else
<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i>{{ $value->user->getPaymentAccountDateFormat() }}</span></a>
@endif
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>
@endif
@else
-
@endif
</td>
<td>
@if($value->user)
@if($value->user->payment_shop)
@if($value->user->isActiveShop())
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> {{ $value->user->getPaymentShopDateFormat() }}</span></a>
@else
<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i>{{ $value->user->getPaymentShopDateFormat() }}</span></a>
@endif
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>
@endif
@else
-
@endif
</td>
<td>
@if($value->user)
@if($value->user->shop)
@if($value->user->shop->active)
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> {{ $value->user->shop->getActiveDateFormatSmall() }}</span></a>
@else
<span class="badge badge-pill badge-warning"><i class="fa fa-ban"></i>{{ $value->user->shop->getActiveDateFormatSmall() }}</span></a>
@endif
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>
@endif
@else
-
@endif
</td>
<td>
@if(!$value->user || !$value->user->payment_shop || !$value->user->isActiveShop())
<button type="submit" class="btn btn-danger btn-xs" name="delete_user_shop" value="{{ $value->id }}"><i class="ion"></i> löschen</button>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{!! Form::close() !!}
@endif
</div>
@endsection

View file

@ -0,0 +1,109 @@
@extends('layouts.layout-2')
@section('content')
<style>
/* Dropzone */
.dropzone {
min-height: 230px;
border: 2px dashed rgba(0, 0, 0, 0.3);
background: white;
border-radius: 6px;
}
.dropzone .dz-message {
font-size: 28px;
}
</style>
<h4 class="font-weight-bold py-3 mb-4">
SysAdmin Kontakte importieren
</h4>
<div class="card mb-4">
<h5 class="card-header">
Excel-Datei hochladen
</h5>
<div class="card-body">
{!! Form::open([ 'url' => route('sysadmin_tool_store', ['import']), 'method' => 'post', 'files' => true, 'enctype' => 'multipart/form-data', 'class' => 'dropzone', 'id' => 'realDropzone' ]) !!}
<div class="fallback">
<input name="file" type="file" multiple>
</div>
{!! Form::close() !!}
<br>
<div class="alert alert-danger alert-dismissable" style="display:none;"></div>
</div>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
var real_dropzone = {
uploadMultiple: false,
parallelUploads: 1,
maxFilesize: 32,
addRemoveLinks: true,
dictDefaultMessage: 'Hier klicken, oder Datei hier reinziehen (Drag&Drop)',
dictFallbackMessage: 'Dein Browser unterstützt Drag&Drop Dateiuploads nicht',
dictFallbackText: 'Benutze das Formular um Deine Dateien hochzuladen',
dictFileTooBig: "Die Datei ist zu groß. Die maximale Dateigröße beträgt 32 MB",
dictInvalidFileType: 'Eine Datei dieses Typs kann nicht hochgeladen werden',
dictResponseError: "Der Server hat ihre Anfrage mit Status error abgelehnt",
dictCancelUpload: 'Hochladen abbrechen',
dictCancelUploadConfirmation: null,
dictRemoveFile: 'Datei entfernen',
dictMaxFilesExceeded: 'Du kannst keine weiteren Dateien mehr hochladen',
// The setting up of the dropzone
init:function() {
console.log("init");
this.on("removedfile", function(file) {
var _ele = $('.alert-danger');
_ele.fadeOut();
} );
this.on("addedfile", function (file) {
var _ele = $('.alert-danger');
_ele.fadeOut();
});
},
error: function(file, response) {
console.log(file);
console.log(response);
var message
if($.type(response) === "string")
message = response; //dropzone sends it's own error messages in string
else
message = response.message;
var _ele = $('.alert-danger');
_ele.fadeIn();
_ele.text(message);
},
success: function(file,response) {
console.log(file);
console.log(response.filename);
console.log(response.filedata);
console.log(response);
if(response.redirect){
window.location.href = response.redirect;
}else{
if(response.error === false){
//true
window.location.href = window.location.href;
}
}
}
};
Dropzone.options.realDropzone = real_dropzone;
</script>
@endsection

View file

@ -0,0 +1,65 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
SysAdmin Berater Bestellungen
</h5>
<div class="col-sm-6 mb-2">
{!! Form::open(['url' => route('sysadmin_tool_store', ['sales_members']), 'class' => 'form-horizontal', 'id'=>'filter_sales_member']) !!}
<label class="form-label" for="filter_user_shop_id">Filter Jahr</label>
<select class="custom-select" name="filter_sales_year" id="filter_sales_year">
@foreach($years as $year)
<option value="{{$year}}" @if($active_year == $year) selected @endif>{{$year}}</option>
@endforeach
</select>
{!! Form::close() !!}
</div>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname') }}</th>
<th>{{__('E-Mail') }}</th>
<th>{{__('Betrag') }}</th>
<th>{{__('Datum') }}</th>
<th>{{__('Order')}}</th>
<th>{{__('Status')}}</th>
</tr>
</thead>
<tbody>
@foreach($values as $value)
<tr>
<td>{{ $value->shopping_user->billing_firstname }}</td>
<td>{{ $value->shopping_user->billing_lastname }}</td>
<td>{{ $value->shopping_user->billing_email }}</td>
<td>{{ $value->getFormattedTotalShipping()."" }}</td>
<td>{{ $value->created_at->format("d.m.Y") }}</td>
<td>@foreach($value->shopping_order_items as $shopping_order_item)
{{ $shopping_order_item->product->name }}<br>
@endforeach
</td>
<td>{!! App\Services\Payment::getShoppingOrderBadge($value) !!}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<script>
$('#filter_sales_year').on('change', function(){
$('#filter_sales_member').submit();
});
</script>
@endsection

View file

@ -0,0 +1,51 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold mb-4">
SysAdmin Shopping Orders
</h4>
<div class="card mb-4">
<div class="card-body">
<!-- Controls -->
{!! Form::open(['url' => route('sysadmin_tool_store', ['sales_members']), 'class' => '']) !!}
<div class="form-group mb-1">
<label class="form-label" for="description">Description</label>
{{ Form::textarea('text', $text, array('class'=>'form-control', 'rows'=>1)) }}
</div>
<button type="submit" name="action" value="first_run" class="btn btn-primary"><i class="ion"></i> first run</button>
<button type="submit" name="action" value="next_run" class="btn btn-primary"><i class="ion"></i> next run</button>
{!! Form::close() !!}
</div>
@if(count($values)>0)
<div class="card-body">
<!-- Controls -->
@foreach($values as $value)
<pre>{{$value->billing_email}} | {{$value->orders}}</pre>
@endforeach
</div>
@endif
</div>
@endsection

View file

@ -47,7 +47,7 @@
<!-- Project details -->
<div class="card mb-4">
<h6 class="card-header">{{ __('Shop details') }}</h6>
<h5 class="card-header">{{ __('Shop details') }}</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="text-muted">{{ __('name') }}</div>

View file

@ -2,8 +2,8 @@
<h6 class="card-header">{{ __('shop image') }}<br><small>{{ __('shop image copy') }}</small>
</h6>
<h5 class="card-header">{{ __('shop image') }}<br><small>{{ __('shop image copy') }}</small>
</h5>
<div class="card-body p-3">
<style>
.dz-message {

View file

@ -8,8 +8,8 @@
<h6 class="card-header">{{ __('shop on site') }}<br><small>{{ __('shop on site copy') }}</small>
</h6>
<h5 class="card-header">{{ __('shop on site') }}<br><small>{{ __('shop on site copy') }}</small>
</h5>
<div class="card-body p-3">
<style>
.dz-message {

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card mb-4">
<h6 class="card-header">
<h5 class="card-header">
{{__('Delete Account')}}
</h6>
</h5>
<div class="card-body">
<p>{{__('Confirm your identity with your password before proceeding.')}}</p>

View file

@ -161,7 +161,7 @@
<div class="col-md-5 col-xl-4 order-1 order-md-2">
<!-- Project details -->
<div class="card mb-4">
<h6 class="card-header">{{ __('Mitgliedschaft Details') }}</h6>
<h5 class="card-header">{{ __('Mitgliedschaft Details') }}</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">

View file

@ -19,7 +19,7 @@
{{ __('navigation.my_team') }}
</h4>
<div class="card">
<h5 class="card-header">Berater registrieren</h5>
<h5 class="card-header">Neuen Berater registrieren</h5>
<div class="row no-gutters row-bordered">
<div class="col-md-12 p-4">
<h6 class="mb-4">Link für Beraterregistrierung</h6>

View file

@ -0,0 +1,107 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold py-2 mb-2">
{{ __('navigation.my_team') }}
</h4>
<div class="card">
<h5 class="card-header">
{{__('Business')}} {{__('Struktur')}}
</h5>
<div class="card-body">
{!! Form::open(['url' => route('user_team_structure'), 'class' => 'form-horizontal', 'id'=>'form_filter_business_user']) !!}
<div class="form-row align-items-center px-0 pb-2 pt-0">
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('team_user_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('team_user_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<hr class="container-m-nx border-light mt-0">
<div>
<div id="nestable-menu" class="mb-4">
<button type="button" class="btn btn-default btn-sm" data-action="expand-all">Alles aufklappen</button>
<button type="button" class="btn btn-default btn-sm" data-action="collapse-all">Alles zuklappen</button>
</div>
<div class="row">
<div class="col-md-12">
<h6 class="">
Dein Sponsor
</h6>
<div class="dd" id="">
{!! $TreeCalcBot->makeSponsorHtml() !!}
</div>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h6 class="">
Dein Team
</h6>
<div class="dd" id="nestable2">
{!! $TreeCalcBot->makeHtmlTree() !!}
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="/vendor/libs/nestable/nestable.css">
<script src="/vendor/libs/nestable/jquery-nestable.js?v=1"></script>
<script>
$( document ).ready(function() {
function updateOutput(e) {
//var list = e.length ? e : $(e.target);
//var output = list.data('output');
};
$('#nestable2').nestable().on('change', updateOutput);
// output initial serialised data
//updateOutput($('#nestable2').data('output', $('#nestable2-output')));
$('#nestable-menu').on('click', function(e) {
var target = $(e.target);
var action = target.data('action');
if (action === 'expand-all') {
$('.dd').nestable('expandAll');
}
if (action === 'collapse-all') {
$('.dd').nestable('collapseAll');
}
});
});
$('.on_change_select_filter').on('change', function(){
$('#form_filter_business_user').submit();
});
</script>
@endsection

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card mb-4">
<h6 class="card-header">
<h5 class="card-header">
{{__('Change E-Mail')}}
</h6>
</h5>
<div class="card-body">
<div class="row">
<div class="col-sm-2"></div>

View file

@ -2,9 +2,9 @@
@section('content')
<div class="card mb-4">
<h6 class="card-header">
<h5 class="card-header">
{{__('Change Password')}}
</h6>
</h5>
<div class="card-body">
{!! Form::open(['url' => route('user_update_password')]) !!}
<div class="form-group row">

Some files were not shown because too many files have changed in this diff Show more