testemich Promotion
This commit is contained in:
parent
38e7fd504a
commit
a0f4eda6ea
83 changed files with 1690 additions and 504 deletions
|
|
@ -76,26 +76,18 @@ class OrderController extends Controller
|
|||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'hp'){
|
||||
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
|
||||
}
|
||||
return '-';
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'txaction', 'is_for', 'shipped'])
|
||||
->rawColumns(['id', 'txaction', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +131,7 @@ class OrderController extends Controller
|
|||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
|
||||
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
|
|
@ -149,9 +141,15 @@ class OrderController extends Controller
|
|||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
|
||||
Yard::instance('shopping')->setShoppingUser($user, true);
|
||||
|
||||
if($for === 'cr'){
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
Yard::instance('shopping')->setShoppingUser($user, false);
|
||||
|
||||
}else{
|
||||
Yard::instance('shopping')->setShoppingUser($user, true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
|
|
@ -166,6 +164,7 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
public function payment($for, $id=null){
|
||||
|
||||
$data = Request::all();
|
||||
$user = User::find(Auth::user()->id);
|
||||
$rules = array(
|
||||
|
|
@ -182,7 +181,6 @@ class OrderController extends Controller
|
|||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if(Yard::instance('shopping')->getNumComp() > 0){
|
||||
if(!isset($data['switchers-comp-product'])){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
|
||||
|
|
@ -236,7 +234,7 @@ class OrderController extends Controller
|
|||
private function checkShoppingCountry($for, $id=null){
|
||||
|
||||
$country_id = null;
|
||||
if($for === 'me'){
|
||||
if($for === 'me' || $for === 'mp' || $for === 'cr'){
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if($user->same_as_billing){
|
||||
$country_id = $user->account->country_id;
|
||||
|
|
@ -279,11 +277,22 @@ class OrderController extends Controller
|
|||
public function datatable(){
|
||||
|
||||
$not_show_pids = ProductBuy::getNotShowProductIDs(Auth::user()->id);
|
||||
if(Request::get('shipping_is_for') === 'me'){
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
}else{
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '1');
|
||||
|
||||
switch (Request::get('shipping_is_for')) {
|
||||
case 'me':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
break;
|
||||
case 'mp':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
break;
|
||||
case 'cr':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '6');
|
||||
break;
|
||||
case 'ot':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '1');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach($not_show_pids as $not_show_pid){
|
||||
$query->where('id', '!=', $not_show_pid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue