Work to invoice
This commit is contained in:
parent
224bf9e951
commit
02e78e7255
101 changed files with 23483 additions and 154 deletions
66
app/Http/Controllers/FileController.php
Normal file
66
app/Http/Controllers/FileController.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\Invoice;
|
||||
use Response;
|
||||
use Storage;
|
||||
|
||||
class FileController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function show($id = null, $disk = null, $do='file')
|
||||
{
|
||||
$path = "";
|
||||
$filename = "";
|
||||
|
||||
|
||||
if($disk === 'user'){
|
||||
$file = \App\Models\File::findOrFail($id);
|
||||
$path = Storage::disk($disk)->path($file->dir.$file->filename);
|
||||
if (file_exists($path)) {
|
||||
return Response::file($path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($disk === 'invoice'){
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
$filename = Invoice::getFilename($shopping_order);
|
||||
$path = Invoice::getDownloadPath($shopping_order);
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
return Response::make('File no found.', 404);
|
||||
}
|
||||
$file = Storage::disk('public')->get($path);
|
||||
$type = Storage::disk('public')->mimeType($path);
|
||||
|
||||
if($do === 'download'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
|
||||
/* $full_path = Invoice::getDownloadPath($shopping_order, true);
|
||||
$he
|
||||
if (file_exists($full_path)) {
|
||||
return Response::download($full_path, $filename);
|
||||
}*/
|
||||
}
|
||||
if($do === 'stream'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header('Content-disposition','filename="'.$filename.'"');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -158,8 +158,6 @@ class LeadController extends Controller
|
|||
if(isset($data['m_account']) && $data['m_account']){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
$rules['m_account'] = 'unique:user_accounts,m_account,'.$user->account->id.',id';
|
||||
|
||||
|
||||
}
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
|
|
@ -363,6 +361,9 @@ class LeadController extends Controller
|
|||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('company', function (User $user) {
|
||||
return $user->account ? $user->account->company : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
|
|
@ -400,8 +401,6 @@ class LeadController extends Controller
|
|||
return "-";
|
||||
})
|
||||
|
||||
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Models\ShoppingOrder;
|
|||
use App\Models\ShoppingPayment;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserShop;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Services\Payment;
|
||||
use Request;
|
||||
|
|
@ -302,10 +303,26 @@ class SalesController extends Controller
|
|||
|
||||
}
|
||||
if(isset($data['back'])){
|
||||
|
||||
return redirect($data['back']);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
public function invoice(){
|
||||
$data = Request::all();
|
||||
//$data['id'] ShoppingOrder id
|
||||
if(!isset($data['id'])){
|
||||
abort(404);
|
||||
}
|
||||
if(isset($data['action'])){
|
||||
if($data['action'] === 'create_invoice'){
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$invoice_repo = new InvoiceRepository($shopping_order);
|
||||
$invoice_repo->create($data);
|
||||
return redirect(route('admin_sales_users_detail', [$shopping_order->id]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\User;
|
|||
use Auth;
|
||||
use Request;
|
||||
use Validator;
|
||||
use App\Models\UserAccount;
|
||||
|
||||
|
||||
class UserDataController extends Controller
|
||||
|
|
@ -47,6 +48,14 @@ class UserDataController extends Controller
|
|||
'address'=>'required',
|
||||
'zipcode'=>'required',
|
||||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
|
|
@ -67,7 +76,6 @@ class UserDataController extends Controller
|
|||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -194,9 +194,13 @@ class WizardController extends Controller
|
|||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday' => 'required',
|
||||
);
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required'
|
||||
);
|
||||
|
||||
if (!Request::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
|
|
@ -397,8 +401,12 @@ class WizardController extends Controller
|
|||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday' => 'required',
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required'
|
||||
);
|
||||
|
||||
if(!Request::get('same_as_billing')){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue