diff --git a/_ide_helper.php b/_ide_helper.php
index deef827..e54cb27 100644
--- a/_ide_helper.php
+++ b/_ide_helper.php
@@ -16963,10 +16963,40 @@
*
* @static
*/
- public static function reCalculateShippingPrice()
+ public static function reCalculate()
{
/** @var \App\Services\Yard $instance */
- return $instance->reCalculateShippingPrice();
+ return $instance->reCalculate();
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function calculateMargins()
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->calculateMargins();
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function getYardMargin()
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->getYardMargin();
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function getYardCommission()
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->getYardCommission();
}
/**
*
@@ -16977,6 +17007,26 @@
{
/** @var \App\Services\Yard $instance */
return $instance->setShippingCountryWithPrice($shipping_country_id, $shipping_is_for);
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function setShoppingUser($user, $payment_credit = false)
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->setShoppingUser($user, $payment_credit);
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function getPaymentCredit()
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->getPaymentCredit();
}
/**
*
@@ -17031,6 +17081,26 @@
{
/** @var \App\Services\Yard $instance */
return $instance->totalWithShipping($decimals, $decimalPoint, $thousandSeperator);
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function totalWithShippingWithoutCredit($decimals = null, $decimalPoint = null, $thousandSeperator = null)
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->totalWithShippingWithoutCredit($decimals, $decimalPoint, $thousandSeperator);
+ }
+ /**
+ *
+ *
+ * @static
+ */
+ public static function totalfromCredit($decimals = null, $decimalPoint = null, $thousandSeperator = null)
+ {
+ /** @var \App\Services\Yard $instance */
+ return $instance->totalfromCredit($decimals, $decimalPoint, $thousandSeperator);
}
/**
* Get the total price of the items in the cart.
@@ -17103,10 +17173,10 @@
* @return float
* @static
*/
- public static function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
+ public static function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null, $discount = true)
{
/** @var \App\Services\Yard $instance */
- return $instance->subtotal($decimals, $decimalPoint, $thousandSeperator);
+ return $instance->subtotal($decimals, $decimalPoint, $thousandSeperator, $discount);
}
/**
*
diff --git a/app/Http/Controllers/Api/ShoppingUserController.php b/app/Http/Controllers/Api/ShoppingUserController.php
index 709471f..69518c9 100755
--- a/app/Http/Controllers/Api/ShoppingUserController.php
+++ b/app/Http/Controllers/Api/ShoppingUserController.php
@@ -626,7 +626,7 @@ class ShoppingUserController extends Controller
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'shipping_net' => Yard::instance('shopping')->shippingNet(2, '.', ''),
- 'subtotal_ws' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
+ 'subtotal_shipping' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => Yard::instance('shopping')->points(),
diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php
index e453c1a..63c161c 100755
--- a/app/Http/Controllers/CustomerController.php
+++ b/app/Http/Controllers/CustomerController.php
@@ -172,7 +172,7 @@ class CustomerController extends Controller
data-action="shopping-user-is-like-member"
data-back="'.route('admin_customers').'"
data-modal="modal-xl"
- data-route="'.route('modal_load').'"> Berater zuordnen';
+ data-route="'.route('modal_load').'"> Vertriebspartner zuordnen';
}
if($ShoppingUser->member_id){
return ''.$ShoppingUser->member->getFullName().'';
diff --git a/app/Http/Controllers/LeadController.php b/app/Http/Controllers/LeadController.php
index 1e4d852..2a18979 100755
--- a/app/Http/Controllers/LeadController.php
+++ b/app/Http/Controllers/LeadController.php
@@ -222,25 +222,27 @@ class LeadController extends Controller
public function released($action, $id){
$user = User::findOrFail($id);
-
if($action === 'completed'){
$validator = Validator::make(Request::all(), []);
- if(!$user->m_sponsor){
- $validator->errors()->add('m_sponsor', __('Berater hat keinen Sponsor.'));
- }
+ /*if(!$user->m_sponsor){
+ $validator->errors()->add('m_sponsor', __('Vertriebspartner hat keinen Sponsor.'));
+ }*/
if(!$user->account->m_first_name){
- $validator->errors()->add('m_first_name', __('Berater hat keinen Vornamen.'));
+ $validator->errors()->add('m_first_name', __('Vertriebspartner hat keinen Vornamen.'));
}
- if(!$user->account->m_first_name){
- $validator->errors()->add('m_last_name', __('Berater hat keinen Nachnamen.'));
- }
- if(!$user->account->m_account){
- $validator->errors()->add('m_account', __('Berater hat keine Account ID'));
+ if(!$user->account->m_last_name){
+ $validator->errors()->add('m_last_name', __('Vertriebspartner hat keinen Nachnamen.'));
}
+
if ($validator->errors()->count()) {
return back()->withErrors($validator)->withRequest(Request::all());
}
+ if(!$user->account->m_account){
+ $user->account->m_account = UserAccount::max('m_account') +1;
+ $user->account->save();
+ }
+
//create PDF
$pdf = new ContractPDFRepository($user);
$pdf->_set('disk', 'user');
@@ -271,7 +273,7 @@ class LeadController extends Controller
}
UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
- \Session()->flash('alert-success', "Berater freigeschaltet!");
+ \Session()->flash('alert-success', "Vertriebspartner freigeschaltet!");
}
if($action === 'incomplete'){
@@ -303,7 +305,7 @@ class LeadController extends Controller
->save();
}
UserHistory::create(['user_id' => $user->id, 'action'=>'released_incomplete', 'status'=>0]);
- \Session()->flash('alert-success', "E-Mail an Berater gesendet.");
+ \Session()->flash('alert-success', "E-Mail an Vertriebspartner gesendet.");
}
return redirect(route('admin_lead_edit', [$user->id]));
diff --git a/app/Http/Controllers/MembershipController.php b/app/Http/Controllers/MembershipController.php
index 7e627c6..d2d53ea 100755
--- a/app/Http/Controllers/MembershipController.php
+++ b/app/Http/Controllers/MembershipController.php
@@ -114,7 +114,7 @@ class MembershipController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for nuy intern
'auth_user_id' => Auth::user()->id,
- 'payment' => 3, //Berater Membership
+ 'payment' => 3, //Vertriebspartner Membership
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
diff --git a/app/Http/Controllers/ModalController.php b/app/Http/Controllers/ModalController.php
index db94f38..2c55d84 100644
--- a/app/Http/Controllers/ModalController.php
+++ b/app/Http/Controllers/ModalController.php
@@ -63,6 +63,12 @@ class ModalController extends Controller
}
+ if($data['action'] === 'user-order-show-user-level-margin'){
+ $user = User::find($data['id']);
+ $ret = view("admin.modal.user_level_margin", compact('user', 'data'))->render();
+ }
+
+
if($data['action'] === 'homeparty-add-product') {
$homeparty = Homeparty::find($data['id']);
$homeparty_user = HomepartyUser::find($data['user_id']);
diff --git a/app/Http/Controllers/PaymentMethodController.php b/app/Http/Controllers/PaymentMethodController.php
index c85c494..afe71fd 100755
--- a/app/Http/Controllers/PaymentMethodController.php
+++ b/app/Http/Controllers/PaymentMethodController.php
@@ -36,6 +36,7 @@ class PaymentMethodController extends Controller
'short' => $data['short'],
'pos' => $data['pos'],
'show_at' => $data['show_at'],
+ 'max_price' => $data['max_price'],
'default' => isset($data['default']) ? true : false,
'active' => isset($data['active']) ? true : false,
]);
@@ -44,6 +45,7 @@ class PaymentMethodController extends Controller
$model->name = $data['name'];
$model->short = $data['short'];
$model->pos = $data['pos'];
+ $model->max_price = $data['max_price'];
$model->show_at = $data['show_at'];
$model->default = isset($data['default']) ? true : false;
$model->active = isset($data['active']) ? true : false;
diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php
index 143d7ec..6979237 100755
--- a/app/Http/Controllers/ProductController.php
+++ b/app/Http/Controllers/ProductController.php
@@ -65,7 +65,10 @@ class ProductController extends Controller
$rules = array(
'name' => 'required',
);
- if($data['wp_number']){
+ /*if(isset($data['number']) && $data['number'] != ""){
+ $rules['number'] = 'int';
+ }*/
+ if(isset($data['wp_number'])){
if($data['id'] !== "new"){
$model = Product::findOrFail($data['id']);
$rules['wp_number'] = 'unique:products,wp_number,'.$model->id;
diff --git a/app/Http/Controllers/SalesController.php b/app/Http/Controllers/SalesController.php
index c39fed1..942aa35 100755
--- a/app/Http/Controllers/SalesController.php
+++ b/app/Http/Controllers/SalesController.php
@@ -80,7 +80,7 @@ class SalesController extends Controller
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Beraterbestellung';
+ return 'Vertriebspartnerbestellung';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return 'Kundenbestellung';
@@ -216,7 +216,7 @@ class SalesController extends Controller
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Beraterbestellung';
+ return 'Vertriebspartnerbestellung';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return 'Kundenbestellung';
@@ -239,7 +239,7 @@ class SalesController extends Controller
data-action="shopping-user-is-like-member"
data-back="'.route('admin_sales_customers').'"
data-modal="modal-xl"
- data-route="'.route('modal_load').'"> Berater zuordnen';
+ data-route="'.route('modal_load').'"> Vertriebspartner zuordnen';
}
return '';
})
diff --git a/app/Http/Controllers/User/CheckoutController.php b/app/Http/Controllers/User/CheckoutController.php
index 1e4ea51..c69bb69 100755
--- a/app/Http/Controllers/User/CheckoutController.php
+++ b/app/Http/Controllers/User/CheckoutController.php
@@ -12,6 +12,7 @@ use App\Models\PaymentTransaction;
use App\Models\ShippingCountry;
use App\Models\ShoppingOrder;
use App\Models\ShoppingOrderItem;
+use App\Models\ShoppingOrderMargin;
use App\Models\ShoppingPayment;
use App\Models\ShoppingUser;
use App\Services\CustomerPriority;
@@ -125,14 +126,13 @@ class CheckoutController extends Controller
if($is_from !== 'shopping' && Util::getAuthUser()){
$user = Util::getAuthUser();
- $payment_methods = $user->payment_methods;
+ $user_payment_methods = $user->payment_methods;
$payment_data = $user->account->payment_data;
}else{
- $payment_methods = PaymentMethod::getDefaultAsArray()->toArray();
+ $user_payment_methods = PaymentMethod::getDefaultAsArray()->toArray();
$payment_data = false;
}
- $payment_methods_active = \App\Models\PaymentMethod::where('active', true)->get()->pluck( 'id', 'short')->toArray();
$data = [
'is_from' => $is_from,
'is_for' => $is_for,
@@ -140,8 +140,7 @@ 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,
+ 'user_payment_methods' => $user_payment_methods,
'identifier' => $identifier,
'payment_data' => $payment_data,
'back' => url()->previous(),
@@ -402,18 +401,25 @@ class CheckoutController extends Controller
private function makeShoppingOrder($shopping_user){
$user_shop = Util::getUserShop();
-
+ $discount = 0;
+ if(Yard::instance('shopping')->getYardMargin()){
+ $discount = Yard::instance('shopping')->getYardMargin()->net_discount;
+ }
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'payment_for' => Util::getUserPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ''),
+ 'subtotal_full' => Yard::instance('shopping')->subtotal(2, '.', '', false),
+ 'discount' => $discount,
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'shipping_net' => Yard::instance('shopping')->shippingNet(2, '.', ''),
- 'subtotal_ws' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
+ 'subtotal_shipping' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
+ 'total_without_credit' => Yard::instance('shopping')->totalWithShippingWithoutCredit(2, '.', ''),
+ 'payment_credit' => Yard::instance('shopping')->totalfromCredit(2, '.', ''),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => Yard::instance('shopping')->points(),
'weight' => Yard::instance('shopping')->weight(),
@@ -433,8 +439,9 @@ class CheckoutController extends Controller
if(!$shopping_order){
$shopping_order = ShoppingOrder::create($data);
}
- $this->putPayments('shopping_order_id', $shopping_order->id);
+ $this->makeOrderMargin($shopping_order);
+ $this->putPayments('shopping_order_id', $shopping_order->id);
$items = Yard::instance('shopping')->getContentByOrder();
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order, $shopping_user) {
foreach ($items as $item) {
@@ -477,6 +484,38 @@ class CheckoutController extends Controller
return $shopping_order;
}
+ private function makeOrderMargin(ShoppingOrder $shopping_order)
+ {
+
+ if (Yard::instance('shopping')->getYardMargin()) {
+
+ $data = [
+ 'shopping_order_id' => $shopping_order->id,
+ 'user_id' => $shopping_order->auth_user_id,
+ 'net_price' => Yard::instance('shopping')->getYardMargin()->net_price,
+ 'net_discount' => Yard::instance('shopping')->getYardMargin()->net_discount,
+ 'net_amount' => Yard::instance('shopping')->getYardMargin()->net_amount,
+ 'from_payment_credit' => Yard::instance('shopping')->totalfromCredit(2, '.', ''),
+ 'from' => now(),
+ 'content' => serialize(Yard::instance('shopping')->getYardMargin()->toArray())
+ ];
+ if(Yard::instance('shopping')->getYardMargin()->net_partner_commission > 0){
+ $data['m_sponsor_id'] = $shopping_order->auth_user->m_sponsor;
+ $data['net_partner_commission'] = Yard::instance('shopping')->getYardMargin()->net_partner_commission;
+ }
+ $shopping_order_margin = false;
+ if ($this->getPayments('shopping_order_margin_id')) {
+ $shopping_order_margin = ShoppingOrderMargin::find($this->getPayments('shopping_order_margin_id'));
+ if ($shopping_order_margin) {
+ $shopping_order_margin->fill($data);
+ $shopping_order_margin->save();}
+ }
+ if (!$shopping_order_margin) {
+ $shopping_order_margin = ShoppingOrderMargin::create($data);
+ }
+ $this->putPayments('shopping_order_margin_id', $shopping_order_margin->id);
+ }
+ }
private function putPayments($key, $value){
$content = $this->getContent();
$content->put($key, $value);
diff --git a/app/Http/Controllers/User/HomepartyController.php b/app/Http/Controllers/User/HomepartyController.php
index f21c44b..bd84eb1 100755
--- a/app/Http/Controllers/User/HomepartyController.php
+++ b/app/Http/Controllers/User/HomepartyController.php
@@ -388,7 +388,7 @@ class HomepartyController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for nuy intern
'auth_user_id' => Auth::user()->id,
- 'payment' => 5, //Berater Membership
+ 'payment' => 5, //Vertriebspartner Membership
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php
index cd0afbe..3c6639f 100755
--- a/app/Http/Controllers/User/OrderController.php
+++ b/app/Http/Controllers/User/OrderController.php
@@ -77,7 +77,7 @@ class OrderController extends Controller
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Beraterbestellung';
+ return 'Vertriebspartnerbestellung';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return 'Kundenbestellung';
@@ -149,6 +149,8 @@ class OrderController extends Controller
}
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
+ Yard::instance('shopping')->setShoppingUser($user, true);
+
$data = [
'shopping_user' => $shopping_user,
@@ -177,7 +179,6 @@ class OrderController extends Controller
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
- dd($validator);
return back()->withErrors($validator)->withInput(Request::all());
}
@@ -214,7 +215,7 @@ class OrderController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
- 'payment' => 2, //Berater Shop
+ 'payment' => 2, //Vertriebspartner Shop
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
@@ -294,12 +295,12 @@ class OrderController extends Controller
$q->where('show_at', '=', 0)
->orWhere('show_at', '=', 1);
});
-
}
- //Kunden und Berater
- //->orWhere('show_at', '=', 2); // Nur Berater
+
+ //Kunden und Vertriebspartner
+ //->orWhere('show_at', '=', 2); // Nur Vertriebspartner
//->orderBy('pos', 'DESC')
//->orderBy('id', 'DESC');
@@ -346,6 +347,7 @@ class OrderController extends Controller
';
})*/
+
->addColumn('picture', function (Product $product) {
if(count($product->images)){
return '';
@@ -361,8 +363,15 @@ class OrderController extends Controller
->addColumn('price_vk_gross', function (Product $product) {
return $product->getFormattedPriceWith(false, false). " €";
})
+ ->addColumn('single_commission', function (Product $product) {
+ return $product->single_commission ? 'Handelspanne: '.$product->getFormattedValueCommission().' %' : 'Staffelprovision ';
+ })
+
+
->addColumn('action', function (Product $product) {
- return '';
})
@@ -379,9 +388,10 @@ class OrderController extends Controller
->orderColumn('price_gross', 'price_gross $1')
->orderColumn('price_vk_gross', 'price $1')
->orderColumn('contents_total', 'contents_total $1')
+ ->orderColumn('single_commission', 'single_commission $1')
->orderColumn('weight', 'weight $1')
- ->rawColumns(['add_card', 'product', 'quantity', 'picture', 'action'])
+ ->rawColumns(['add_card', 'product', 'quantity', 'picture', 'action', 'single_commission'])
->make(true);
}
@@ -401,7 +411,16 @@ class OrderController extends Controller
}
//get the card item
- $cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true), $product->tax, ['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), $product->tax,
+ [
+ 'image' => $image,
+ 'slug' => $product->slug,
+ 'weight' => $product->weight,
+ 'single_commission' => $product->single_commission,
+ 'amount_commission' => $product->amount_commission,
+ 'value_commission' => $product->value_commission,
+ 'partner_commission' => $product->partner_commission,
+ ]);
Yard::setTax($cartItem->rowId, $product->tax);
if(isset($data['qty']) && $data['qty'] > 0){
@@ -411,10 +430,8 @@ class OrderController extends Controller
Yard::instance('shopping')->remove($cartItem->rowId);
}
//
- Yard::instance('shopping')->reCalculateShippingPrice();
- //$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
+ Yard::instance('shopping')->reCalculate();
$html_card = view("user.order.yard_view_form", $data)->render();
- //$html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>'']);
}
@@ -435,19 +452,6 @@ class OrderController extends Controller
//$html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>'']);
}
- /* if($data['action'] === 'updateCompProduct'){
- // $data['comp_product_id']
- // $data['comp_num']
- //count_comp_products
- $this->updateCompProduct($data);
- Yard::instance('shopping')->reCalculateShippingPrice();
- $html_card = view("user.order.yard_view_form", $data)->render();
- $html_comp = view("user.order.comp_product", $data)->render();
-
- return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
-
- }
- */
return response()->json(['response' => false, 'data'=>$data]);
}
}
@@ -484,10 +488,5 @@ class OrderController extends Controller
}
}
- private function getCompProducts($for){
- if($for === 'me'){
- return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
- }
- return null;
- }*/
+ */
}
\ No newline at end of file
diff --git a/app/Http/Controllers/UserLevelController.php b/app/Http/Controllers/UserLevelController.php
index fe7a1fe..0586eb4 100755
--- a/app/Http/Controllers/UserLevelController.php
+++ b/app/Http/Controllers/UserLevelController.php
@@ -5,8 +5,11 @@ namespace App\Http\Controllers;
use App\Models\Attribute;
use App\Models\ProductAttribute;
+use App\Models\Shipping;
use App\Models\UserLevel;
+use App\Models\UserLevelMargin;
use Request;
+use Validator;
class UserLevelController extends Controller
@@ -27,42 +30,95 @@ class UserLevelController extends Controller
return view('admin.level.index', $data);
}
+ public function edit($id)
+ {
+ if($id === "new"){
+ $user_level = new UserLevel();
+ $user_level->active = 1;
+
+ }else{
+ $user_level = UserLevel::findOrFail($id);
+
+ }
+ $data = [
+ 'value' => $user_level,
+ ];
+ return view('admin.level.edit', $data);
+
+
+ }
public function store()
{
$data = Request::all();
- if($data['id'] == "new"){
- $model = UserLevel::create([
- 'name' => $data['name'],
- 'pos' => $data['pos'],
- 'content' => $data['content'],
- 'active' => isset($data['active']) ? true : false,
- ]);
- }else{
- $model = UserLevel::find($data['id']);
- $model->name = $data['name'];
- $model->pos = $data['pos'];
- $model->content = $data['content'];
- $model->active = isset($data['active']) ? true : false;
- $model->save();
- }
- if(!empty($data['trans'])){
- $trans = [];
- foreach ($data['trans'] as $lang => $value){
- if($value && $value != null){
- $trans[$lang] = $value;
+ if($data['action'] === 'user_level') {
+ if ($data['id'] === "new") {
+ $user_level = UserLevel::create([
+ 'name' => $data['name'],
+ 'pos' => $data['pos'],
+ 'content' => $data['content'],
+ 'partner_provision' => isset($data['partner_provision']) ? true : false,
+ 'active' => isset($data['active']) ? true : false,
+ ]);
+ } else {
+ $user_level = UserLevel::find($data['id']);
+ $user_level->name = $data['name'];
+ $user_level->pos = $data['pos'];
+ $user_level->content = $data['content'];
+ $user_level->partner_provision = isset($data['partner_provision']) ? true : false;
+ $user_level->active = isset($data['active']) ? true : false;
+ $user_level->save();
+ }
+
+ if (!empty($data['trans'])) {
+ $trans = [];
+ foreach ($data['trans'] as $lang => $value) {
+ if ($value && $value != null) {
+ $trans[$lang] = $value;
+ }
+ }
+ if (count($trans)) {
+ $user_level->trans_name = $trans;
+ $user_level->save();
}
}
- if(count($trans)){
- $model->trans_name = $trans;
- $model->save();
+ }
+
+ if($data['action'] === 'user_level_margin') {
+ $user_level = UserLevel::findOrFail($data['user_level_id']);
+ $rules = array('price_from' => 'required');
+ $ret = ['value' => $user_level];
+ $validator = Validator::make(Request::all(), $rules);
+ if ($validator->fails()) {
+ return view('admin.level.edit', $ret)->withErrors($validator);
+ }
+ if ($data['id'] === "new") {
+ $user_level_margin = UserLevelMargin::create($data);
+ } else {
+ $user_level_margin = UserLevelMargin::findOrFail($data['id']);
+ if($user_level_margin->user_level_id != $user_level->id){
+ abort(404);
+ }
+ $user_level_margin->fill($data);
+ $user_level_margin->save();
}
}
\Session()->flash('alert-save', '1');
- return redirect(route('admin_levels'));
+ return redirect(route('admin_level_edit', [$user_level->id]));
+ }
+
+ public function delete($do, $id)
+ {
+ if($do === 'user_level_margin'){
+ $model = UserLevelMargin::findOrFail($id);
+ $id = $model->user_level->id;
+ $model->delete();
+ \Session()->flash('alert-success', "Eintrag gelöscht");
+ return redirect(route('admin_level_edit', [$id]));
+ }
}
diff --git a/app/Http/Controllers/WizardController.php b/app/Http/Controllers/WizardController.php
index 623dd7f..2a0f155 100755
--- a/app/Http/Controllers/WizardController.php
+++ b/app/Http/Controllers/WizardController.php
@@ -480,7 +480,7 @@ class WizardController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
- 'payment' => 4, //Berater Wizard
+ 'payment' => 4, //Vertriebspartner Wizard
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
diff --git a/app/Mail/MailInfo.php b/app/Mail/MailInfo.php
index ed1d238..6860fc5 100644
--- a/app/Mail/MailInfo.php
+++ b/app/Mail/MailInfo.php
@@ -58,16 +58,16 @@ class MailInfo extends Mailable
}
$content .= "E-Mail: ".$this->user->email;
- $copy1line = "Infos zum Berater:"."\n";
- $button = "zum Berater";
- $title = "Ein Berater möchte seine Mitgliedschaft beenden.";
+ $copy1line = "Infos zum Vertriebspartner:"."\n";
+ $button = "zum Vertriebspartner";
+ $title = "Ein Vertriebspartner möchte seine Mitgliedschaft beenden.";
$url = route('admin_lead_edit', $this->user->id).'?show=check_lead';
}
if($this->action === "check_is_like_customer") {
$copy1line = "Hier geht es zum Kunden:"."\n";
$button = "zum Kunden";
- $title = "Ein Kunden muss überprüft werden und einem Berater zugeordnet werden, da die Adresse nicht eindeutig ist.";
+ $title = "Ein Kunden muss überprüft werden und einem Vertriebspartner zugeordnet werden, da die Adresse nicht eindeutig ist.";
$url = route('admin_customer_detail', $this->user->id);
$content .= $this->user ? 'Firma: '.$this->user->billing_company."\n" : '';
$content .= \App\Services\HTMLHelper::getSalutationLang($this->user->billing_salutation)." ";
diff --git a/app/Mail/MailReleaseAccount.php b/app/Mail/MailReleaseAccount.php
index 8a39056..1f66d21 100644
--- a/app/Mail/MailReleaseAccount.php
+++ b/app/Mail/MailReleaseAccount.php
@@ -18,7 +18,7 @@ class MailReleaseAccount extends Mailable
public function __construct(User $user)
{
$this->user = $user;
- $this->subject = 'Neuer Berater Registrierung prüfen';
+ $this->subject = 'Neuer Vertriebspartner Registrierung prüfen';
}
@@ -42,19 +42,19 @@ class MailReleaseAccount extends Mailable
$content .= "E-Mail: ".$this->user->email;
- $copy1line = "Ein neuer Berater hat sich registriert und wartet auf die Überprüfung und Freigabe seiner Daten:"."\n";
+ $copy1line = "Ein neuer Vertriebspartner hat sich registriert und wartet auf die Überprüfung und Freigabe seiner Daten:"."\n";
$copy1line .= "+ Überprüfung der Ausweisdate"."\n";
$copy1line .= "+ Überprüfung des Gewerbenachweises"."\n";
$copy1line .= "+ Eintrag Account ID"."\n";
$copy1line .= "+ Überprüfung / Kenntnisnahme Sponsor"."\n";
$copy1line .= "+ Überprüfung der Rechnungsdaten"."\n";
- $copy1line .= 'Nach erfolgreicher Überprüfung mit dem Button „Daten vollständig => Berater freischalten“ den Berater freischalten.'."\n";
- $copy1line .= 'Der Berater erhält eine Mail, dass sein Account freigeschaltet wurde. Der Vertrag wird automatisch mit den Daten des Vertriebspartners erstellt.'."\n";
+ $copy1line .= 'Nach erfolgreicher Überprüfung mit dem Button „Daten vollständig => Vertriebspartner freischalten“ den Vertriebspartner freischalten.'."\n";
+ $copy1line .= 'Der Vertriebspartner erhält eine Mail, dass sein Account freigeschaltet wurde. Der Vertrag wird automatisch mit den Daten des Vertriebspartners erstellt.'."\n";
return $this->view('emails.info')->with([
'url' => route('admin_lead_edit', $this->user->id).'?show=check_lead',
- 'title' => 'Berater Registrierung prüfen',
- 'button' => 'zur Berater Prüfung',
+ 'title' => 'Vertriebspartner Registrierung prüfen',
+ 'button' => 'zur Vertriebspartner Prüfung',
'copy1line' => $copy1line,
'copy2line' => __('email.copy2line'),
'content' => $content,
diff --git a/app/Models/PaymentMethod.php b/app/Models/PaymentMethod.php
index 1eaef29..3807797 100644
--- a/app/Models/PaymentMethod.php
+++ b/app/Models/PaymentMethod.php
@@ -6,6 +6,7 @@
namespace App\Models;
+use App\Services\Util;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
@@ -35,6 +36,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShowAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
* @mixin \Eloquent
+ * @property string|null $max_price
+ * @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereMaxPrice($value)
*/
class PaymentMethod extends Model
{
@@ -52,6 +55,7 @@ class PaymentMethod extends Model
'name',
'short',
'show_at',
+ 'max_price',
'pos',
'default',
'active'
@@ -59,11 +63,11 @@ class PaymentMethod extends Model
public static $showATs = [
0 => 'Nur Kunden Shop',
- 1 => 'Nur Berater Shop',
- 2 => 'Kunden + Berater Shop',
- 3 => 'Nur Reg/Mitgliedschaft Berater',
- 4 => 'Kunden + Berater Shop + Reg/Mitgliedschaft',
- 5 => 'Berater Shop + Reg/Mitgliedschaft',
+ 1 => 'Nur Vertriebspartner Shop',
+ 2 => 'Kunden + Vertriebspartner Shop',
+ 3 => 'Nur Reg/Mitgliedschaft Vertriebspartner',
+ 4 => 'Kunden + Vertriebspartner Shop + Reg/Mitgliedschaft',
+ 5 => 'Vertriebspartner Shop + Reg/Mitgliedschaft',
9 => 'überall',
];
@@ -74,4 +78,37 @@ class PaymentMethod extends Model
public static function getDefaultAsArray($short=false){
return PaymentMethod::where('active', true)->where('default', true)->pluck('id');
}
+
+ public function setMaxPriceAttribute($value)
+ {
+ $this->attributes['max_price'] = $value ? Util::reFormatNumber($value) : null;
+ }
+
+ public function getFormattedMaxPrice()
+ {
+ return isset($this->attributes['max_price']) ? Util::formatNumber($this->attributes['max_price']) : "";
+ }
+
+ /**
+ * @param $short //PP FNC VOR CC SB ...
+ * @param $user_payment_methods //PaymentMethod [] IDs
+ * @param $total //Full price
+ */
+ public static function isShowPaymentMethod($short, $user_payment_methods, $total = 0){
+
+ $payment_method = PaymentMethod::whereShort($short)->first();
+
+ if($payment_method && $payment_method->active){
+ if(in_array($payment_method->id, $user_payment_methods)){
+ if($payment_method->max_price > 0){
+ if($payment_method->max_price >= $total){
+ return true;
+ }
+ }else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/app/Models/Product.php b/app/Models/Product.php
index 6a59e2c..fef49cd 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -103,13 +103,20 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read int|null $country_prices_count
* @property int|null $wp_number
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereWpNumber($value)
- * @property bool|null $shipping_addon
+ * @property bool|null $single_commission
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereShippingAddon($value)
* @property-read int|null $ingredients_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductIngredient[] $product_ingredients
* @property-read int|null $product_ingredients_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Ingredient[] $p_ingredients
* @property-read int|null $p_ingredients_count
+ * @property bool $amount_commission
+ * @property string|null $value_commission
+ * @property string|null $partner_commission
+ * @method static \Illuminate\Database\Eloquent\Builder|Product whereAmountCommission($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Product wherePartnerCommission($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Product whereSingleCommission($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Product whereValueCommission($value)
*/
class Product extends Model
{
@@ -132,7 +139,8 @@ class Product extends Model
'trans_ingredients' => 'array',
'action' => 'array',
'wp_number' => 'int',
- 'shipping_addon' => 'bool',
+ 'single_commission' => 'bool',
+ 'amount_commission' => 'bool',
'active' => 'bool'
];
use Sluggable;
@@ -164,7 +172,10 @@ class Product extends Model
'amount',
'active',
'show_at',
- 'shipping_addon',
+ 'single_commission',
+ 'amount_commission',
+ 'value_commission',
+ 'partner_commission',
'identifier',
'action',
'upgrade_to_id'
@@ -175,8 +186,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',
- //'proportional_voucher' => 'Anteiliger Gutschein Berater',
+ 'upgrade_member' => 'Vertriebspartnerupgrade zur Karriere ID',
+ //'proportional_voucher' => 'Anteiliger Gutschein Vertriebspartner',
];
@@ -190,12 +201,12 @@ class Product extends Model
public $showATs = [
0 => 'Nur Kunden Bestellungen',
- 1 => 'Kunden + Berater Bestellungen',
- 2 => 'Nur Berater Bestellungen',
- 3 => 'Registrierung / Mitgliedschaft Berater',
- 4 => 'Nur Mitgliedschaft Berater',
- //5 => 'Onboarding Berater',
- //6 => 'Onboarding Berater + Berater Shop',
+ 1 => 'Kunden + Vertriebspartner Bestellungen',
+ 2 => 'Nur Vertriebspartner Bestellungen',
+ 3 => 'Registrierung / Mitgliedschaft Vertriebspartner',
+ 4 => 'Nur Mitgliedschaft Vertriebspartner',
+ //5 => 'Onboarding Vertriebspartner',
+ //6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop',
7 => 'zur internen Berechnung',
];
@@ -279,6 +290,14 @@ class Product extends Model
$this->attributes['price_old'] = $value ? Util::reFormatNumber($value) : null;
}
+ public function setValueCommissionAttribute( $value ) {
+ $this->attributes['value_commission'] = $value ? Util::reFormatNumber($value) : 0;
+ }
+
+ public function setPartnerCommissionAttribute( $value ) {
+ $this->attributes['partner_commission'] = $value ? Util::reFormatNumber($value) : 0;
+ }
+
public function getFormattedPrice()
{
return isset($this->attributes['price']) ? Util::formatNumber($this->attributes['price']) : "";
@@ -298,6 +317,16 @@ class Product extends Model
{
return isset($this->attributes['price_old']) ? Util::formatNumber($this->attributes['price_old']) : "";
}
+ public function getFormattedValueCommission()
+ {
+ return isset($this->attributes['value_commission']) ? Util::formatNumber($this->attributes['value_commission']) : 0;
+ }
+
+ public function getFormattedPartnerCommission()
+ {
+ return isset($this->attributes['partner_commission']) ? Util::formatNumber($this->attributes['partner_commission']) : 0;
+ }
+
/*price by user Factor*/
private function calcPriceUserFactor($price){
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index e3a0761..268168e 100644
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Setting
- *
+ *
* @property int $id
* @property string|null $identifier
* @property string $slug
@@ -23,8 +23,27 @@ use Illuminate\Database\Eloquent\Model;
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- *
* @package App\Models
+ * @property string|null $full_text
+ * @property string|null $text
+ * @property string|null $type
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting findSimilarSlugs(string $attribute, array $config, string $slug)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting newQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting query()
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereAction($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereFullText($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereIdentifier($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereObject($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereReferenz($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereSlug($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereText($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Setting whereUpdatedAt($value)
+ * @mixin \Eloquent
*/
class Setting extends Model
{
diff --git a/app/Models/ShoppingOrder.php b/app/Models/ShoppingOrder.php
index 50f60c7..812bf2b 100644
--- a/app/Models/ShoppingOrder.php
+++ b/app/Models/ShoppingOrder.php
@@ -69,7 +69,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed()
* @property-read \App\Models\ShippingCountry $shipping_country
* @property float|null $shipping_net
- * @property float|null $subtotal_ws
+ * @property float|null $subtotal_shipping
* @property int|null $points
* @property int|null $shipped
* @property string|null $tracking
@@ -82,6 +82,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value)
* @property array|null $wp_notice
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
+ * @property string|null $subtotal_full
+ * @property-read \App\Models\ShoppingOrderMargin|null $shopping_order_margin
+ * @property-read \App\Models\ShoppingPayment|null $shopping_payment_last
+ * @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereSubtotalFull($value)
+ * @property string|null $discount
+ * @property string|null $payment_credit
+ * @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereDiscount($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder wherePaymentCredit($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereSubtotalShipping($value)
*/
class ShoppingOrder extends Model
{
@@ -97,11 +106,15 @@ class ShoppingOrder extends Model
'country_id',
'user_shop_id',
'total',
+ 'subtotal_full',
+ 'discount',
'subtotal',
'shipping',
'shipping_net',
- 'subtotal_ws',
+ 'subtotal_shipping',
'tax',
+ 'total_without_credit',
+ 'payment_credit',
'total_shipping',
'points',
'weight',
@@ -176,6 +189,10 @@ class ShoppingOrder extends Model
return $this->hasOne('App\Models\UserHistory','shopping_order_id')->latest();
}
+ public function shopping_order_margin()
+ {
+ return $this->hasOne('App\Models\ShoppingOrderMargin','shopping_order_id')->latest();
+ }
public function shopping_order_items(){
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
@@ -228,11 +245,21 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['total']);
}
+ public function getFormattedSubtotalFull()
+ {
+ return formatNumber($this->attributes['subtotal_full']);
+ }
+
public function getFormattedSubtotal()
{
return formatNumber($this->attributes['subtotal']);
}
+ public function getFormattedDiscount()
+ {
+ return formatNumber($this->attributes['discount']);
+ }
+
public function getFormattedShipping()
{
return formatNumber($this->attributes['shipping']);
@@ -243,15 +270,24 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['shipping_net']);
}
- public function getFormattedSubtotalWs()
+ public function getFormattedSubtotalShipping()
{
- return formatNumber($this->attributes['subtotal_ws']);
+ return formatNumber($this->attributes['subtotal_shipping']);
}
public function getFormattedTax()
{
return formatNumber($this->attributes['tax']);
}
+ public function getFormattedTotalWithoutCredit()
+ {
+ return formatNumber($this->attributes['total_without_credit']);
+ }
+ public function getFormattedPaymentCredit()
+ {
+ return formatNumber($this->attributes['payment_credit']);
+ }
+
public function getFormattedTotalShipping()
{
diff --git a/app/Models/ShoppingOrderMargin.php b/app/Models/ShoppingOrderMargin.php
new file mode 100644
index 0000000..f7c740b
--- /dev/null
+++ b/app/Models/ShoppingOrderMargin.php
@@ -0,0 +1,108 @@
+ 'int',
+ 'user_id' => 'int',
+ 'net_price' => 'float',
+ 'net_discount' => 'float',
+ 'net_amount' => 'float',
+ 'from_payment_credit' => 'float',
+ 'm_sponsor_id' => 'int',
+ 'net_partner_commission' => 'float',
+ 'paid' => 'bool',
+ 'cancellation' => 'bool',
+ 'status' => 'int'
+ ];
+
+ protected $dates = [
+ 'from'
+ ];
+
+ protected $fillable = [
+ 'shopping_order_id',
+ 'user_id',
+ 'net_price',
+ 'net_discount',
+ 'net_amount',
+ 'from_payment_credit',
+ 'm_sponsor_id',
+ 'net_partner_commission',
+ 'from',
+ 'paid',
+ 'cancellation',
+ 'status',
+ 'content'
+ ];
+
+ public function user()
+ {
+ return $this->belongsTo(User::class, 'user_id');
+ }
+
+ public function shopping_order()
+ {
+ return $this->belongsTo(ShoppingOrder::class, 'shopping_order_id');
+ }
+
+ public function m_sponsor_id()
+ {
+ return $this->belongsTo(User::class, 'm_sponsor_id');
+ }
+}
diff --git a/app/Models/UserLevel.php b/app/Models/UserLevel.php
index 0fd87bb..63dce5d 100644
--- a/app/Models/UserLevel.php
+++ b/app/Models/UserLevel.php
@@ -31,15 +31,21 @@ use Illuminate\Database\Eloquent\Model;
* @property array|null $trans_content
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereContent($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereTransContent($value)
+ * @property bool $partner_provision
+ * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserLevelMargin[] $user_level_margins
+ * @property-read int|null $user_level_margins_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserLevelMargin[] $user_level_margins_re
+ * @property-read int|null $user_level_margins_re_count
+ * @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePartnerProvision($value)
*/
class UserLevel extends Model
{
protected $table = 'user_levels';
- protected $casts = ['trans_name' => 'array', 'trans_content' => 'array'];
+ protected $casts = ['trans_name' => 'array', 'trans_content' => 'array', 'partner_provision'=>'bool'];
protected $fillable = [
- 'name', 'content', 'pos', 'active',
+ 'name', 'content', 'pos', 'active', 'partner_provision',
];
@@ -49,6 +55,17 @@ class UserLevel extends Model
}
*/
+
+ public function user_level_margins()
+ {
+ return $this->hasMany('App\Models\UserLevelMargin', 'user_level_id', 'id');
+ }
+
+ public function user_level_margins_re()
+ {
+ return $this->hasMany('App\Models\UserLevelMargin', 'user_level_id', 'id')->orderBy('price_from', 'DESC');
+ }
+
public function setPosAttribute($value){
$this->attributes['pos'] = is_numeric($value) ? $value : null;
diff --git a/app/Models/UserLevelMargin.php b/app/Models/UserLevelMargin.php
new file mode 100644
index 0000000..31c0eaf
--- /dev/null
+++ b/app/Models/UserLevelMargin.php
@@ -0,0 +1,90 @@
+ 'int',
+ 'price_from' => 'float',
+ 'trading_margin' => 'float',
+ 'commission' => 'float'
+ ];
+
+ protected $fillable = [
+ 'user_level_id',
+ 'price_from',
+ 'trading_margin',
+ 'commission'
+ ];
+
+ public function user_level()
+ {
+ return $this->belongsTo(UserLevel::class);
+ }
+
+
+ public function setPriceFromAttribute($value)
+ {
+ $this->attributes['price_from'] = $value ? Util::reFormatNumber($value) : 0;
+ }
+
+ public function getFormattedPriceFrom()
+ {
+ return isset($this->attributes['price_from']) ? Util::formatNumber($this->attributes['price_from']) : "";
+ }
+
+ public function setTradingMarginAttribute($value)
+ {
+ $this->attributes['trading_margin'] = $value ? Util::reFormatNumber($value) : 0;
+ }
+
+ public function getFormattedTradingMargin()
+ {
+ return isset($this->attributes['trading_margin']) ? Util::formatNumber($this->attributes['trading_margin']) : "";
+ }
+
+ public function setCommissionAttribute($value)
+ {
+ $this->attributes['commission'] = $value ? Util::reFormatNumber($value) : 0;
+ }
+
+ public function getFormattedCommission()
+ {
+ return isset($this->attributes['commission']) ? Util::formatNumber($this->attributes['commission']) : "";
+ }
+}
diff --git a/app/Repositories/ContractPDFRepository.php b/app/Repositories/ContractPDFRepository.php
index 98f2446..47cd281 100644
--- a/app/Repositories/ContractPDFRepository.php
+++ b/app/Repositories/ContractPDFRepository.php
@@ -128,7 +128,7 @@ class ContractPDFRepository extends BaseRepository {
if(!Storage::disk($this->disk)->exists( $this->dir )){
Storage::disk($this->disk)->makeDirectory($this->dir); //creates directory
}
- $filename = "Beratervertrag.pdf";
+ $filename = "Vertriebspartnervertrag.pdf";
Storage::disk($this->disk)->put($this->dir.$filename, $pdf->Output('S'));
$size = Storage::disk($this->disk)->size($this->dir.$filename);
$mine = Storage::disk($this->disk)->getMimeType($this->dir.$filename);
diff --git a/app/Repositories/ProductRepository.php b/app/Repositories/ProductRepository.php
index 432148b..5117861 100644
--- a/app/Repositories/ProductRepository.php
+++ b/app/Repositories/ProductRepository.php
@@ -27,9 +27,8 @@ class ProductRepository extends BaseRepository {
{
$data['active'] = isset($data['active']) ? 1 : 0;
- $data['shipping_addon'] = isset($data['shipping_addon']) ? 1 : 0;
-
-
+ $data['single_commission'] = isset($data['single_commission']) ? 1 : 0;
+ $data['amount_commission'] = isset($data['amount_commission']) ? 1 : 0;
if($data['id'] === "new"){
$this->model = Product::create($data);
}
diff --git a/app/Services/HTMLHelper.php b/app/Services/HTMLHelper.php
index 09602fe..9ef46eb 100644
--- a/app/Services/HTMLHelper.php
+++ b/app/Services/HTMLHelper.php
@@ -65,6 +65,29 @@ class HTMLHelper
}
+ public static function setContentReadMore($content){
+
+ $sep = '##mehr lesen##';
+ if(strpos($content, $sep) !== false){
+ $name = 'collapse_'.random_int(1000, 10000);
+ $split = explode($sep, $content);
+ $first = isset($split[0]) ? $split[0] : "";
+ $text = isset($split[1]) ? $split[1] : "";
+
+ $content = $first;
+ $content .= '
+ '.__('mehr lesen').'
+ '.__('weniger lesen').'
+ ';
+ $content .= '
Wir legen nicht nur auf die Qualität unserer Produkte einen hohen Stellenwert, sondern natürlich auch - auf umfassende, kompetente Beratung durch freundliche und fachkundige Berater und Beraterinnen.
+ auf umfassende, kompetente Beratung durch freundliche und fachkundige Vertriebspartner und Vertriebspartnerinnen.Wir entwickeln und vertreiben ausschließlich Produkte, die qualitativ hochwertig sind. So sind sie bei sachgemäßer Anwendung und Pflege langlebig und sehr ergiebig. Faktoren, die uns die diff --git a/resources/views/_bak/web/templates/card.blade.php b/resources/views/_bak/web/templates/card.blade.php index ef8df5f..3d48be7 100644 --- a/resources/views/_bak/web/templates/card.blade.php +++ b/resources/views/_bak/web/templates/card.blade.php @@ -344,7 +344,7 @@ zur Kasse
Sie werden auf unseren checkout Server weitergeletet, die Verbindung ist mit SSL verschlüsselt.
+Du werden auf unseren checkout weitergeletet, die Verbindung ist mit SSL verschlüsselt.
Zweimal jährlich veranstaltet MIVITA eine Schulung für Berater. Neben Eurer Begehung der Farm +
Zweimal jährlich veranstaltet MIVITA eine Schulung für Vertriebspartner. Neben Eurer Begehung der Farm und Produktionsstätte, weiht Euch Farmbetreiber Werner Telwest in die Geheimnisse der „Wüstenlilie“ ein. Und das Beste: Zu jeder Schulung gibt es eine Ausschreibung. Wer entsprechend Umsatz generiert wird mit der Reise von MIVITA belohnt und fliegt FOR FREE auf diff --git a/resources/views/_bak/web/templates/partner.blade.php b/resources/views/_bak/web/templates/partner.blade.php index 11a29ed..2467de8 100644 --- a/resources/views/_bak/web/templates/partner.blade.php +++ b/resources/views/_bak/web/templates/partner.blade.php @@ -57,7 +57,7 @@
Wir legen jedem Berater ans Herz, mit uns gemeinsam die Aloe Vera Schulung auf Mallorca zu erleben. Hierzu haben wir für Euch gemeinsam mit unserem Reise-Portal NETWORKTRIPS und angeschlossenem Reisebüro STERN TOURS in Berlin verschiedene Buchungsmöglichkeiten für
+
Wir legen jedem Vertriebspartner ans Herz, mit uns gemeinsam die Aloe Vera Schulung auf Mallorca zu erleben. Hierzu haben wir für Euch gemeinsam mit unserem Reise-Portal NETWORKTRIPS und angeschlossenem Reisebüro STERN TOURS in Berlin verschiedene Buchungsmöglichkeiten für
• Nur-Hotel
• Hotel & Flug
diff --git a/resources/views/_bak/web/templates/vereinbarkeit.blade.php b/resources/views/_bak/web/templates/vereinbarkeit.blade.php
index 5d9d642..700bfc2 100644
--- a/resources/views/_bak/web/templates/vereinbarkeit.blade.php
+++ b/resources/views/_bak/web/templates/vereinbarkeit.blade.php
@@ -35,7 +35,7 @@
Insbesondere im Direktvertrieb mit seinen Möglichkeiten der freien Zeiteinteilung und passivem Einkommen hast Du mittelfristig soviel Freiheit, wie es Dir ein fester Job nicht - bieten kann. Als selbständige MIVITA Beraterin entscheidest Du selbst, wann und wo Du + bieten kann. Als selbständige MIVITA Vertriebspartnerin entscheidest Du selbst, wann und wo Du arbeitest. Und das betrifft ja nicht nur junge Eltern. Auch für Menschen, die ihre Familienangehörigen pflegen müssen oder einfach grundsätzlich mehr Zeit und finanzielle Entlastung erreichen wollen, stellt der Direktvertrieb eine perfekte Lösung dar: diff --git a/resources/views/_bak/web/templates/vorteile.blade.php b/resources/views/_bak/web/templates/vorteile.blade.php index 12c4fc5..df00a0f 100644 --- a/resources/views/_bak/web/templates/vorteile.blade.php +++ b/resources/views/_bak/web/templates/vorteile.blade.php @@ -54,7 +54,7 @@
Es gibt sehr viele gute Gründe, um sich mit mivita selbständig zu machen. Viele Beraterinnen und Beratern antworten auf die Frage, warum sie sich für den Direktvertrieb bei mivita entschieden haben:
+Es gibt sehr viele gute Gründe, um sich mit mivita selbständig zu machen. Viele Vertriebspartnerinnen und Vertriebspartnern antworten auf die Frage, warum sie sich für den Direktvertrieb bei mivita entschieden haben:
Wir legen nicht nur auf die Qualität unserer Produkte einen hohen Stellenwert, sondern natürlich auch - auf umfassende, kompetente Beratung durch freundliche und fachkundige Berater und Beraterinnen.
+ auf umfassende, kompetente Beratung durch freundliche und fachkundige Vertriebspartner und Vertriebspartnerinnen.Wir entwickeln und vertreiben ausschließlich Produkte, die qualitativ hochwertig sind. So sind sie bei sachgemäßer Anwendung und Pflege langlebig und sehr ergiebig. Faktoren, die uns die diff --git a/resources/views/admin/customer/_detail.blade.php b/resources/views/admin/customer/_detail.blade.php index acf8ee6..af7b802 100644 --- a/resources/views/admin/customer/_detail.blade.php +++ b/resources/views/admin/customer/_detail.blade.php @@ -70,14 +70,14 @@
| # | {{__('Nummer')}} | {{__('E-Mail')}} | -{{__('ist Berater')}} | +{{__('ist Vertriebspartner')}} | {{__('Anrede')}} | {{__('Firma')}} | {{__('Vorname')}} | @@ -56,7 +56,7 @@{{__('Land')}} | {{__('Käufe')}} | {{__('Newsletter')}} | -{{__('zugewiesener Berater')}} | +{{__('zugewiesener Vertriebspartner')}} | {{__('Datum')}} | @@ -66,7 +66,7 @@
|---|