Komp / Max Produkt,

This commit is contained in:
Kevin Adametz 2021-06-18 15:01:01 +02:00
parent a4c76d06fa
commit 78f43169c8
19 changed files with 347 additions and 51 deletions

8
.env
View file

@ -5,10 +5,10 @@ APP_DEBUG=true
APP_URL=https://partner.gruene-seele.test APP_URL=https://partner.gruene-seele.test
APP_DOMAIN=partner.gruene-seele.test APP_DOMAIN=partner.gruene-seele.test
APP_CHECKOUT_MAIL=kevin.adametz@me.com APP_CHECKOUT_MAIL=register@adametz.media
APP_CHECKOUT_TEST_MAIL=kevin.adametz@me.com APP_CHECKOUT_TEST_MAIL=register@adametz.media
APP_INFO_MAIL=kevin.adametz@me.com APP_INFO_MAIL=register@adametz.media
APP_INFO_TEST_MAIL=kevin.adametz@me.com APP_INFO_TEST_MAIL=register@adametz.media
APP_MAIN_TAX = 1.19 APP_MAIN_TAX = 1.19
APP_MAIN_TAX_RATE = 19 APP_MAIN_TAX_RATE = 19

View file

@ -34,10 +34,10 @@ class SettingController extends Controller
{ {
$data = Request::all(); $data = Request::all();
if(isset($data['action'])){ if(isset($data['action'])){
if(isset($data['settings'])){ if(isset($data['settings'])){
foreach ($data['settings'] as $key=>$value){ foreach ($data['settings'] as $key=>$value){
$value['val'] = isset($value['val']) ? $value['val'] : false;
Setting::setContentBySlug($key, $value['val'], $value['type']); Setting::setContentBySlug($key, $value['val'], $value['type']);
} }
} }

View file

@ -479,6 +479,7 @@ class CheckoutController extends Controller
]; ];
$shopping_order_item = ShoppingOrderItem::create($data); $shopping_order_item = ShoppingOrderItem::create($data);
} }
} }
return $shopping_order; return $shopping_order;
} }

View file

@ -18,7 +18,7 @@ use App\Models\ProductCategory;
use App\Models\ShippingCountry; use App\Models\ShippingCountry;
use App\Models\ShoppingInstance; use App\Models\ShoppingInstance;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\ProductBuy;
class OrderController extends Controller class OrderController extends Controller
{ {
@ -153,7 +153,6 @@ class OrderController extends Controller
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for); Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
Yard::instance('shopping')->setShoppingUser($user, true); Yard::instance('shopping')->setShoppingUser($user, true);
$data = [ $data = [
'shopping_user' => $shopping_user, 'shopping_user' => $shopping_user,
'user' => $user, 'user' => $user,
@ -161,7 +160,7 @@ class OrderController extends Controller
'isView' => 'customer', 'isView' => 'customer',
'for' => $for, 'for' => $for,
'delivery_id' => $delivery_id, 'delivery_id' => $delivery_id,
//'comp_products' => $this->getCompProducts($for), 'comp_products' => $this->getCompProducts($for),
]; ];
return view('user.order.list', $data); return view('user.order.list', $data);
} }
@ -184,7 +183,7 @@ class OrderController extends Controller
return back()->withErrors($validator)->withInput(Request::all()); return back()->withErrors($validator)->withInput(Request::all());
} }
/* if(Yard::instance('shopping')->getNumComp() > 0){ if(Yard::instance('shopping')->getNumComp() > 0){
if(!isset($data['switchers-comp-product'])){ if(!isset($data['switchers-comp-product'])){
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus')); $validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
}else{ }else{
@ -200,7 +199,7 @@ class OrderController extends Controller
return back()->withErrors($validator)->withInput(Request::all()); return back()->withErrors($validator)->withInput(Request::all());
} }
} }
*/
/*do { /*do {
$identifier = Util::getToken(); $identifier = Util::getToken();
} while( ShoppingInstance::where('identifier', $identifier)->count() );*/ } while( ShoppingInstance::where('identifier', $identifier)->count() );*/
@ -280,6 +279,7 @@ class OrderController extends Controller
public function datatable(){ public function datatable(){
$show_at = 1; $show_at = 1;
$not_show_pids = ProductBuy::getNotShowProductIDs(Auth::user()->id);
if(Request::get('shipping_is_for') === 'me'){ if(Request::get('shipping_is_for') === 'me'){
$query = Product::with('categories')->select('products.*')->where('active', true)->where(function ($q) { $query = Product::with('categories')->select('products.*')->where('active', true)->where(function ($q) {
$q->where('show_at', '=', 1) $q->where('show_at', '=', 1)
@ -294,6 +294,12 @@ class OrderController extends Controller
->orWhere('show_at', '=', 1); ->orWhere('show_at', '=', 1);
}); });
} }
foreach($not_show_pids as $not_show_pid){
$query->where('id', '!=', $not_show_pid);
}
//Kunden und Vertriebspartner //Kunden und Vertriebspartner
//->orWhere('show_at', '=', 2); // Nur Vertriebspartner //->orWhere('show_at', '=', 2); // Nur Vertriebspartner
//->orderBy('pos', 'DESC') //->orderBy('pos', 'DESC')
@ -418,7 +424,7 @@ class OrderController extends Controller
$data = Request::all(); $data = Request::all();
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot'; $is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot';
// $data['comp_products'] = $this->getCompProducts($is_for); $data['comp_products'] = $this->getCompProducts($is_for);
if($data['action'] === 'updateCart' && isset($data['product_id'])){ if($data['action'] === 'updateCart' && isset($data['product_id'])){
if($product = Product::find($data['product_id'])){ if($product = Product::find($data['product_id'])){
@ -448,9 +454,12 @@ class OrderController extends Controller
} }
// //
Yard::instance('shopping')->reCalculate(); Yard::instance('shopping')->reCalculate();
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
$html_card = view("user.order.yard_view_form", $data)->render(); $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'=>'']);
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
} }
} }
if($data['action'] === 'clearCart') { if($data['action'] === 'clearCart') {
@ -462,18 +471,30 @@ class OrderController extends Controller
if(isset($data['shipping_country_id'])){ if(isset($data['shipping_country_id'])){
if($shipping_country = ShippingCountry::find($data['shipping_country_id'])){ if($shipping_country = ShippingCountry::find($data['shipping_country_id'])){
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for); Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for);
//$this->checkCompProduct(Yard::instance('shopping')->getNumComp()); $this->checkCompProduct(Yard::instance('shopping')->getNumComp());
} }
} }
$html_card = view("user.order.yard_view_form", $data)->render(); $html_card = view("user.order.yard_view_form", $data)->render();
//$html_comp = view("user.order.comp_product", $data)->render(); $html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>'']); return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$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]); return response()->json(['response' => false, 'data'=>$data]);
} }
} }
/* private function checkCompProduct($count_comp_products){ private function checkCompProduct($count_comp_products){
foreach (Yard::instance('shopping')->content() as $row) { foreach (Yard::instance('shopping')->content() as $row) {
//wenn gleich löschen, da neue Versandkosten //wenn gleich löschen, da neue Versandkosten
if($row->options->comp > $count_comp_products) { if($row->options->comp > $count_comp_products) {
@ -486,8 +507,10 @@ class OrderController extends Controller
foreach (Yard::instance('shopping')->content() as $row) { foreach (Yard::instance('shopping')->content() as $row) {
//wenn kleiner wurde ein produkt entfernt aufgrund der Anzahl //wenn kleiner wurde ein produkt entfernt aufgrund der Anzahl
//wenn gleich löschen, da neue Versandkosten //wenn gleich löschen, da neue Versandkosten
if($row->options->comp === $data['comp_num'] || $row->options->comp > $data['count_comp_products']) { if($row->options->comp === $data['comp_num'] || $row->options->comp > $data['count_comp_products']) {
Yard::instance('shopping')->remove($row->rowId); Yard::instance('shopping')->remove($row->rowId);
} }
} }
@ -497,13 +520,33 @@ class OrderController extends Controller
if ($product->images->count()) { if ($product->images->count()) {
$image = $product->images->first()->slug; $image = $product->images->first()->slug;
} }
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, $cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, 0,
['image' => $image, 'slug' => $product->slug, 'weight' => 0, 'points' => 0, [
'comp' => $data['comp_num'], 'product_id' => $product->id]); 'image' => $image,
'slug' => $product->slug,
'weight' => 0,
'single_commission' => 0,
'amount_commission' => 0,
'value_commission' => 0,
'partner_commission' => 0,
'comp' => $data['comp_num'],
'product_id' => $product->id
]);
Yard::setTax($cartItem->rowId, 0); Yard::setTax($cartItem->rowId, 0);
} }
} }
} }
*/ private function getCompProducts($for){
if($for === 'me' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_me')){
return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
}
if($for === 'ot' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_ot')){
return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
}
return null;
}
} }

View file

@ -141,7 +141,10 @@ class Product extends Model
'wp_number' => 'int', 'wp_number' => 'int',
'single_commission' => 'bool', 'single_commission' => 'bool',
'amount_commission' => 'bool', 'amount_commission' => 'bool',
'active' => 'bool' 'active' => 'bool',
'shipping_addon' => 'bool',
'max_buy' => 'bool',
'max_buy_num' => 'int'
]; ];
use Sluggable; use Sluggable;
@ -178,7 +181,10 @@ class Product extends Model
'partner_commission', 'partner_commission',
'identifier', 'identifier',
'action', 'action',
'upgrade_to_id' 'upgrade_to_id',
'shipping_addon',
'max_buy',
'max_buy_num'
]; ];
public $identifiers_types = [ public $identifiers_types = [
@ -249,6 +255,10 @@ class Product extends Model
return $this->hasMany(CountryPrice::class, 'product_id'); return $this->hasMany(CountryPrice::class, 'product_id');
} }
public function product_buys()
{
return $this->hasMany(ProductBuy::class, 'product_id');
}
public function p_ingredients() public function p_ingredients()
{ {

72
app/Models/ProductBuy.php Normal file
View file

@ -0,0 +1,72 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class ProductBuy
*
* @property int $id
* @property int $auth_user_id
* @property int $product_id
* @property int $num
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Product $product
*
* @package App\Models
*/
class ProductBuy extends Model
{
protected $table = 'product_buys';
protected $casts = [
'auth_user_id' => 'int',
'product_id' => 'int',
'num' => 'int'
];
protected $fillable = [
'auth_user_id',
'product_id',
'num'
];
public function product()
{
return $this->belongsTo(Product::class);
}
public function user()
{
return $this->belongsTo('App\User','auth_user_id');
}
public function auth_user()
{
return $this->belongsTo('App\User','auth_user_id');
}
public static function getNotShowProductIDs($user_id){
$ret = [];
$ProductBuys = ProductBuy::where('auth_user_id', $user_id)->get();
if($ProductBuys){
foreach($ProductBuys as $ProductBuy){
if($ProductBuy->product){
if($ProductBuy->product->max_buy && $ProductBuy->num >= $ProductBuy->product->max_buy_num){
$ret[] = $ProductBuy->product->id;
}
}
}
}
return $ret;
}
}

View file

@ -77,6 +77,10 @@ class Setting extends Model
'object' => 'Object', 'object' => 'Object',
'full_text' => 'Full Text', 'full_text' => 'Full Text',
'text' => 'Text', 'text' => 'Text',
'int' => 'Zahl',
'bool' => 'Bool',
]; ];
public function sluggable() public function sluggable()
@ -103,6 +107,9 @@ class Setting extends Model
case 'int': case 'int':
return $content->int; return $content->int;
break; break;
case 'bool':
return $content->int === 1 ? true : false;
break;
} }
} }
return false; return false;
@ -120,17 +127,20 @@ class Setting extends Model
$content->type = $type; $content->type = $type;
switch ($content->type){ switch ($content->type){
case 'object': case 'object':
$content->object = $value; $content->object = $value ? $value : null;;
break; break;
case 'full_text': case 'full_text':
$content->full_text = $value; $content->full_text = $value ? $value : null;;
break; break;
case 'text': case 'text':
$content->text = $value; $content->text = $value ? $value : null;;
break; break;
case 'int': case 'int':
$content->int = (int) $value; $content->int = (int) $value;
break; break;
case 'bool':
$content->int = $value ? 1 : 0;
break;
} }
$content->save(); $content->save();

View file

@ -29,6 +29,9 @@ class ProductRepository extends BaseRepository {
$data['active'] = isset($data['active']) ? 1 : 0; $data['active'] = isset($data['active']) ? 1 : 0;
$data['single_commission'] = isset($data['single_commission']) ? 1 : 0; $data['single_commission'] = isset($data['single_commission']) ? 1 : 0;
$data['amount_commission'] = isset($data['amount_commission']) ? 1 : 0; $data['amount_commission'] = isset($data['amount_commission']) ? 1 : 0;
$data['shipping_addon'] = isset($data['shipping_addon']) ? 1 : 0;
$data['max_buy'] = isset($data['max_buy']) ? 1 : 0;
if($data['id'] === "new"){ if($data['id'] === "new"){
$this->model = Product::create($data); $this->model = Product::create($data);

View file

@ -2,13 +2,15 @@
namespace App\Services; namespace App\Services;
use App\Mail\MailCheckout; use App\User;
use App\Models\Product;
use App\Models\Setting; use App\Models\Setting;
use App\Mail\MailCheckout;
use App\Models\ProductBuy;
use App\Models\ShoppingOrder; use App\Models\ShoppingOrder;
use App\Models\UserPayCredit;
use App\Models\ShoppingPayment; use App\Models\ShoppingPayment;
use App\Models\UserCreditMargin; use App\Models\UserCreditMargin;
use App\Models\UserPayCredit;
use App\User;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
class Payment class Payment
@ -117,6 +119,23 @@ class Payment
]); ]);
} }
public static function addProductBuy(User $user, Product $product){
if($product->max_buy && $product->max_buy_num > 0){
$ProductBuy = ProductBuy::where('auth_user_id', $user->id)->where('product_id', $product->id)->first();
if(!$ProductBuy){
ProductBuy::create([
'auth_user_id' => $user->id,
'product_id' => $product->id,
'num' => 1,
]);
}else{
$ProductBuy->num = $ProductBuy->num+1;
$ProductBuy->save();
}
}
}
public static function paymentStatusPaidAction(ShoppingOrder $shopping_order, $paid){ public static function paymentStatusPaidAction(ShoppingOrder $shopping_order, $paid){
$send_link = false; $send_link = false;
@ -129,8 +148,14 @@ class Payment
if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){ if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
foreach($shopping_order->shopping_order_items as $shopping_order_item){ foreach($shopping_order->shopping_order_items as $shopping_order_item){
if($shopping_order_item->product){ if($shopping_order_item->product){
if($shopping_order_item->product->action){ //add product when buy
$user = User::findOrFail($shopping_order->auth_user_id); $user = User::findOrFail($shopping_order->auth_user_id);
if($shopping_order_item->product->max_buy && $shopping_order_item->product->max_buy_num > 0){
self::addProductBuy($user, $shopping_order_item->product);
}
//product action
if($shopping_order_item->product->action){
$user->save(); $user->save();
$send_link = true; $send_link = true;
//new date //new date

View file

@ -22,7 +22,7 @@ class Yard extends Cart
private $shipping_tax = 0; private $shipping_tax = 0;
private $shipping_country_id = 0; //default de private $shipping_country_id = 0; //default de
private $shipping_is_for; private $shipping_is_for;
//private $num_comp; private $num_comp;
private $ysession; private $ysession;
private $yinstance; private $yinstance;
private $shopping_data = []; private $shopping_data = [];
@ -87,9 +87,9 @@ class Yard extends Cart
$this->global_tax_rate = config('cart.tax'); $this->global_tax_rate = config('cart.tax');
} }
/*if($this->getYardExtra('num_comp')){ if($this->getYardExtra('num_comp')){
$this->num_comp = $this->getYardExtra('num_comp'); $this->num_comp = $this->getYardExtra('num_comp');
}*/ }
parent::__construct($session, $events); parent::__construct($session, $events);
@ -164,6 +164,9 @@ class Yard extends Cart
return $this->ysession->get($this->yinstance); return $this->ysession->get($this->yinstance);
} }
public function reCalculateShippingPrice(){
$this->calculateShippingPrice();
}
public function reCalculate(){ public function reCalculate(){
$this->calculateShippingPrice(); $this->calculateShippingPrice();
@ -328,18 +331,23 @@ class Yard extends Cart
} }
if($shipping_price){ if($shipping_price){
$price = $shipping_price->price; $price = $shipping_price->price;
/*$this->num_comp = 0; $this->num_comp = 0;
if($this->shipping_is_for === 'me'){
if($this->shipping_is_for === 'me' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_me')){
$price = $shipping_price->price_comp; $price = $shipping_price->price_comp;
$this->num_comp = $shipping_price->num_comp; $this->num_comp = $shipping_price->num_comp;
}
if($this->shipping_is_for === 'ot' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_ot')){
$price = $shipping_price->price_comp;
$this->num_comp = $shipping_price->num_comp;
}
}*/
$this->shipping_price = $price; $this->shipping_price = $price;
$this->shipping_tax_rate = $shipping_price->tax_rate; $this->shipping_tax_rate = $shipping_price->tax_rate;
$this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2); $this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2); $this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
//$this->putYardExtra('num_comp', $this->num_comp); $this->putYardExtra('num_comp', $this->num_comp);
$this->putYardExtra('shipping_price', $this->shipping_price); $this->putYardExtra('shipping_price', $this->shipping_price);
$this->putYardExtra('shipping_tax_rate', $this->shipping_tax_rate); $this->putYardExtra('shipping_tax_rate', $this->shipping_tax_rate);
$this->putYardExtra('shipping_tax', $this->shipping_tax); $this->putYardExtra('shipping_tax', $this->shipping_tax);
@ -627,7 +635,7 @@ class Yard extends Cart
} }
public function getNumComp(){ public function getNumComp(){
return 0; //$this->num_comp; return $this->num_comp;
} }
public function getCompProductBy($comp, $product_id=false){ public function getCompProductBy($comp, $product_id=false){

View file

@ -69,6 +69,11 @@ class CreateProductsTable extends Migration
$table->string('identifier', 20)->nullable(); $table->string('identifier', 20)->nullable();
$table->boolean('shipping_addon')->default(false);
$table->boolean('max_buy')->default(false);
$table->tinyInteger('max_buy_num')->unsigned()->nullable()->default(0);
$table->string('action')->nullable(); $table->string('action')->nullable();
//is an upgrade product, set this product id by payments API paid //is an upgrade product, set this product id by payments API paid

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProductBuysTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('product_buys', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('auth_user_id');
$table->unsignedInteger('product_id');
$table->unsignedTinyInteger('num')->default(0);
$table->timestamps();
$table->foreign('product_id')
->references('id')
->on('products');
$table->foreign('user_id')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_buys');
}
}

View file

@ -58,11 +58,10 @@ var IqShoppingCart = {
event.preventDefault(); event.preventDefault();
_self.update_cart_database($(this).data('product-id'), 0); _self.update_cart_database($(this).data('product-id'), 0);
}); });
if(_self.is_for === 'me'){
$('input[name^="'+_self.comp_products+'"]').on('change', function(){ $('input[name^="'+_self.comp_products+'"]').on('change', function(){
_self.update_comp_product($(this)); _self.update_comp_product($(this));
}); });
}
}, },
update_shipping_state : function (_obj){ update_shipping_state : function (_obj){
var _self = this; var _self = this;

View file

@ -46,6 +46,29 @@
{{ Form::textarea('copy', $product->copy , array('placeholder'=>__('Produktbeschreibung'), 'class'=>'form-control summernote', 'id'=>'copy')) }} {{ Form::textarea('copy', $product->copy , array('placeholder'=>__('Produktbeschreibung'), 'class'=>'form-control summernote', 'id'=>'copy')) }}
</div> </div>
<div class="form-row">
<div class="form-group col-sm-6">
<label class="custom-control custom-checkbox mt-2">
{!! 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>
<label class="custom-control custom-checkbox mt-2">
{!! Form::checkbox('max_buy', 1, $product->max_buy, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Maximaler Kauf für einen Berater für dieses Produkt</span>
</label>
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="max_buy_num">{{ __('Anzahl maximaler Kauf pro Berater') }}</label>
{{ Form::text('max_buy_num', $product->max_buy_num, array('placeholder'=>__('in Stück'), 'class'=>'form-control', 'id'=>'max_buy_num')) }}
</div>
</div>
</div> </div>
</div> </div>

View file

@ -26,7 +26,9 @@
<th>{{__('Grundpreis')}}</th> <th>{{__('Grundpreis')}}</th>
<th>{{__('Gewicht')}}</th> <th>{{__('Gewicht')}}</th>
<th>{{__('sichbar')}}</th> <th>{{__('sichbar')}}</th>
<th>{{__('ER')}}</th> <th><div data-toggle="tooltip" title data-original-title="Kompensationsprodukt">{{__('KP')}}</div></th>
<th><div data-toggle="tooltip" title data-original-title="Maximaler Kauf pro Berater">{{__('MK')}}</div></th>
<th><div data-toggle="tooltip" title data-original-title="Einzelrabatt">{{__('ER')}}</div></th>
<th>{{__('Status')}}</th> <th>{{__('Status')}}</th>
<th></th> <th></th>
</tr> </tr>
@ -58,6 +60,8 @@
<td>{{ $value->getBasePriceFormatted() }}</td> <td>{{ $value->getBasePriceFormatted() }}</td>
<td>{{ $value->weight }}</td> <td>{{ $value->weight }}</td>
<td>{{ $value->getShowAtType() }}</td> <td>{{ $value->getShowAtType() }}</td>
<td data-sort="{{ $value->shipping_addon }}">{!! get_active_badge($value->shipping_addon) !!}</td>
<td data-sort="{{ $value->max_buy }}">{!! get_active_badge($value->max_buy) !!}</td>
<td data-sort="{{ $value->single_commission }}">{!! get_active_badge($value->single_commission) !!}</td> <td data-sort="{{ $value->single_commission }}">{!! get_active_badge($value->single_commission) !!}</td>
<td data-sort="{{ $value->active }}">{!! get_active_badge($value->active) !!}</td> <td data-sort="{{ $value->active }}">{!! get_active_badge($value->active) !!}</td>
<td><a class="text-info" href="{{ route('admin_product_copy', [$value->id]) }}" onclick="return confirm('{{__('Eintrag kopieren?')}}');"><i class="far fa-copy"></i></a> &nbsp; <td><a class="text-info" href="{{ route('admin_product_copy', [$value->id]) }}" onclick="return confirm('{{__('Eintrag kopieren?')}}');"><i class="far fa-copy"></i></a> &nbsp;

View file

@ -71,6 +71,35 @@
</div> </div>
</div> </div>
<div class="card mb-2">
<div class="card-body">
<h4>Kauf Einstellungen</h4>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="custom-control custom-checkbox mt-2">
{!! Form::checkbox('settings[order_partner_is_comp_me][val]', 1, \App\Models\Setting::getContentBySlug('order_partner_is_comp_me'), ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Kompensationprodukt bei Beraterbestellungen für sich</span>
</label>
{{ Form::hidden('settings[order_partner_is_comp_me][type]', 'bool') }}
<label class="custom-control custom-checkbox mt-3">
{!! Form::checkbox('settings[order_partner_is_comp_ot][val]', 1, \App\Models\Setting::getContentBySlug('order_partner_is_comp_ot'), ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Kompensationprodukt bei Beraterbestellungen für Kunden</span>
</label>
{{ Form::hidden('settings[order_partner_is_comp_ot][type]', 'bool') }}
</div>
<div class="form-group col-sm-12">
<label class="form-label">{{ __('Beschreibung Kompensationprodukt, wird als Subline angezeigt.') }}</label>
{!! Form::textarea('settings[order_partner_comp_text][val]', \App\Models\Setting::getContentBySlug('order_partner_comp_text'), array('class'=>'form-control', 'rows'=>3)) !!}
{{ Form::hidden('settings[order_partner_comp_text][type]', 'full_text') }}
</div>
</div>
<button type="submit" name="action" value="save_prepayment" class="btn btn-primary btn-sm mb-2"><i class="ion ion-ios-save"></i> speichern</button>
</div>
</div>
{!! Form::close() !!} {!! Form::close() !!}
@endsection @endsection

View file

@ -69,7 +69,8 @@
<tr> <tr>
<th style="max-width: 60px;">&nbsp;</th> <th style="max-width: 60px;">&nbsp;</th>
<th>{{__('Kunden Preis')}}</th> <th>{{__('Kunden Preis')}}</th>
<th>{{__('Kompensation Preis')}}</th>
<th>{{__('Anzahl KP')}}</th>
<th>{{__('Tax')}}</th> <th>{{__('Tax')}}</th>
<th>{{__('Preis von - bis')}}</th> <th>{{__('Preis von - bis')}}</th>
<th>{{__('Gewicht von - bis')}}</th> <th>{{__('Gewicht von - bis')}}</th>
@ -96,6 +97,8 @@
</button> </button>
</td> </td>
<td>{{ $price->getFormattedPrice() }}</td> <td>{{ $price->getFormattedPrice() }}</td>
<td>{{ $price->getFormattedPriceComp() }}</td>
<td>{{ $price->num_comp }}</td>
<td>{{ $price->getFormattedTaxRate() }}</td> <td>{{ $price->getFormattedTaxRate() }}</td>
<td>{{ $price->getFormatTotalFrom() }} - {{ $price->getFormattedTotalTo() }}</td> <td>{{ $price->getFormatTotalFrom() }} - {{ $price->getFormattedTotalTo() }}</td>
<td>{{ $price->weight_from }} - {{ $price->weight_to }}</td> <td>{{ $price->weight_from }} - {{ $price->weight_to }}</td>
@ -109,6 +112,8 @@
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price" <button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-price"
data-id="new" data-id="new"
data-price="" data-price=""
data-price_comp=""
data-num_comp=""
data-tax_rate="" data-tax_rate=""
data-factor="1" data-factor="1"
data-total_from="" data-total_from=""
@ -141,12 +146,21 @@
<label for="price" class="form-label">{{__('Kunden Preis (brutto)')}}*</label> <label for="price" class="form-label">{{__('Kunden Preis (brutto)')}}*</label>
<input type="text" class="form-control" name="price" placeholder="{{__('Preis in Euro')}}" required> <input type="text" class="form-control" name="price" placeholder="{{__('Preis in Euro')}}" required>
</div> </div>
<div class="form-group col-6">
<label for="price_comp" class="form-label">{{__('Kompensation Preis (brutto)')}}*</label>
<input type="text" class="form-control" name="price_comp" placeholder="{{__('Preis in Euro')}}" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-6"> <div class="form-group col-6">
<label for="tax_rate" class="form-label">{{__('enthaltene Tax (%)')}}</label> <label for="tax_rate" class="form-label">{{__('enthaltene Tax (%)')}}</label>
<input type="text" class="form-control" name="tax_rate" placeholder="{{__('Tax in %')}}"> <input type="text" class="form-control" name="tax_rate" placeholder="{{__('Tax in %')}}">
</div> </div>
<div class="form-group col-6">
<label for="num_comp" class="form-label">{{__('Anzahl Kompensationsprodukte')}}*</label>
<input type="text" class="form-control" name="num_comp" placeholder="{{__('Anzahl Kompensationsprodukte')}}" required>
</div>
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-6"> <div class="form-group col-6">
@ -255,6 +269,8 @@
var button = $(event.relatedTarget); var button = $(event.relatedTarget);
$(this).find(".modal-content input[name='id']").val(button.data('id')); $(this).find(".modal-content input[name='id']").val(button.data('id'));
$(this).find(".modal-body input[name='price']").val(button.data('price')); $(this).find(".modal-body input[name='price']").val(button.data('price'));
$(this).find(".modal-body input[name='price_comp']").val(button.data('price_comp'));
$(this).find(".modal-body input[name='num_comp']").val(button.data('num_comp'));
$(this).find(".modal-body input[name='tax_rate']").val(button.data('tax_rate')); $(this).find(".modal-body input[name='tax_rate']").val(button.data('tax_rate'));
$(this).find(".modal-body input[name='factor']").val(button.data('factor')); $(this).find(".modal-body input[name='factor']").val(button.data('factor'));
$(this).find(".modal-body input[name='total_from']").val(button.data('total_from')); $(this).find(".modal-body input[name='total_from']").val(button.data('total_from'));

View file

@ -9,6 +9,11 @@
@else @else
<h4 class="border-bottom pb-2">Versand Kompensationsprodukt</h4> <h4 class="border-bottom pb-2">Versand Kompensationsprodukt</h4>
@endif @endif
@if($order_partner_comp_text = \App\Models\Setting::getContentBySlug('order_partner_comp_text'))
{!! nl2br($order_partner_comp_text) !!}
<hr>
@endif
<div class="row no-gutters row-bordered"> <div class="row no-gutters row-bordered">
@php($counter = 1) @php($counter = 1)
@php($checked_id = Yard::instance('shopping')->getCompProductBy($i)) @php($checked_id = Yard::instance('shopping')->getCompProductBy($i))

View file

@ -109,11 +109,11 @@
</div> </div>
</div> </div>
@if($for === 'me') @if($comp_products)
{{-- <div id="holder_html_view_comp_product"> <div id="holder_html_view_comp_product">
@include('user.order.comp_product') @include('user.order.comp_product')
</div> </div>
--}}
@endif @endif
<div class="card mt-4"> <div class="card mt-4">
@ -191,5 +191,5 @@
@endsection @endsection
@section('scripts') @section('scripts')
<script src="{{ asset('/js/iq-shopping-cart.js') }}?v=1{{ get_file_last_time('/js/iq-shopping-cart.js') }}"></script> <script src="{{ asset('/js/iq-shopping-cart.js') }}?v=2{{ get_file_last_time('/js/iq-shopping-cart.js') }}"></script>
@endsection @endsection