Work to invoice

This commit is contained in:
Kevin Adametz 2021-02-10 10:42:24 +01:00
parent 224bf9e951
commit 02e78e7255
101 changed files with 23483 additions and 154 deletions

View file

@ -2,21 +2,22 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Auth;
use Yard;
use Request;
use App\User;
use Validator;
use App\Services\Util;
use App\Models\Product;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use App\Models\ShoppingOrder;
use App\Models\ShoppingUser;
use App\Models\UserHistory;
use App\Models\UserShop;
use App\Services\Payment;
use App\Services\Util;
use App\User;
use Auth;
use Request;
use Validator;
use Yard;
use App\Models\UserHistory;
use App\Models\ShoppingUser;
use App\Models\ShoppingOrder;
use App\Models\ProductCategory;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use App\Http\Controllers\Controller;
class OrderController extends Controller
@ -278,12 +279,8 @@ class OrderController extends Controller
public function datatable(){
$show_at = 1;
// $user = User::find(\Auth::user()->id);
;
if(Request::get('shipping_is_for') === 'me'){
$query = Product::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)
->orWhere('show_at', '=', 2)
->orWhere('show_at', '=', 6);
@ -291,14 +288,11 @@ class OrderController extends Controller
});
}else{
$query = Product::select('products.*')->where('active', true)->where(function ($q) {
$query = Product::with('categories')->select('products.*')->where('active', true)->where(function ($q) {
$q->where('show_at', '=', 0)
->orWhere('show_at', '=', 1);
});
}
//Kunden und Vertriebspartner
//->orWhere('show_at', '=', 2); // Nur Vertriebspartner
//->orderBy('pos', 'DESC')
@ -347,21 +341,32 @@ class OrderController extends Controller
</div>';
})*/
->addColumn('category', function (Product $product) {
$ret = "";
foreach($product->categories as $category){
$ret .= '<span><div style="white-space: nowrap">'.$category->category->name.'</div></span>';
}
return $ret;
})
->addColumn('picture', function (Product $product) {
if(count($product->images)){
return '<img class="img-fluid img-extra" alt="" src="'.route('product_image', [$product->images->first()->slug]).'">';
return '<a href="" class="" data-modal="modal-lg" data-toggle="modal" data-target="#modals-load-content" data-id="'.$product->id.'" data-route="'.route('modal_load').'"
data-action="user-order-show-product" data-view="customer">
<img class="img-fluid img-extra" alt="" src="'.route('product_image', [$product->images->first()->slug]).'">
<div class="text-center"><i class="ion ion-md-eye"></i></div></a>';
}
return "";
})
->addColumn('price_net', function (Product $product) {
return $product->getFormattedPriceWith(true, true). "";
return $product->getFormattedPriceWith(true, true). "";
})
->addColumn('price_gross', function (Product $product) {
return $product->getFormattedPriceWith(false, true). " ";
return $product->getFormattedPriceWith(false, true). "";
})
->addColumn('price_vk_gross', function (Product $product) {
return $product->getFormattedPriceWith(false, false). " ";
return $product->getFormattedPriceWith(false, false). "";
})
->addColumn('single_commission', function (Product $product) {
return $product->single_commission ? '<span class="badge badge-warning">Handelspanne: '.$product->getFormattedValueCommission().' %</span>' : '<span class="badge badge-primary">Staffelprovision</span> <button class="btn btn-default btn-xs icon-btn md-btn-flat product-tooltip" title="details" data-modal="modal-lg"
@ -390,8 +395,21 @@ class OrderController extends Controller
->orderColumn('contents_total', 'contents_total $1')
->orderColumn('single_commission', 'single_commission $1')
->orderColumn('weight', 'weight $1')
// ->orderColumn('category', 'weight $1')
/*->orderColumn('category', function ($query, $order) {
$query->whereHas('categories',
function ($q) use ($order) {
// $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //)
})->orderBy(
ProductCategory::select('id')
->whereColumn('product_id', 'produkt.id')
->orderBy('id', 'DESC')
->limit(1)
, $order);
})*/
->rawColumns(['add_card', 'product', 'quantity', 'picture', 'action', 'single_commission'])
->rawColumns(['add_card', 'category', 'product', 'quantity', 'picture', 'action', 'single_commission'])
->make(true);
}