Registierung Korrekturen

This commit is contained in:
Kevin Adametz 2020-04-29 20:06:51 +02:00
parent 8e4bb0c2f6
commit d8b5206031
70 changed files with 1192 additions and 569 deletions

View file

@ -15,6 +15,7 @@ use Auth;
use Hash;
use Illuminate\Support\Facades\Mail;
use Input;
use Request;
use Validator;
use Yard;
@ -60,8 +61,8 @@ class WizardController extends Controller
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
if($step == 15){
@ -90,10 +91,12 @@ class WizardController extends Controller
if($step >= 10){
return redirect('/home');
}
$data = [
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
];
if($step == 5){
return view('user.wizard.register_release', $data);
@ -118,11 +121,11 @@ class WizardController extends Controller
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
$data = [
'user' => Auth::user(),
'step' => 0,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
@ -157,6 +160,7 @@ class WizardController extends Controller
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
];
$user->wizard = 0;
$user->save();
@ -239,15 +243,36 @@ class WizardController extends Controller
if ($step == 3) {
if(Input::get('submit') === 'do'){
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
$validator = Validator::make(Input::all(), []);
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
$user->wizard = 3;
$user->save();
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
$data = Request::all();
if($data['business_license_choose'] === "now"){
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
$validator = Validator::make(Input::all(), []);
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
$user->wizard = 3;
$user->save();
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
}
}
if($data['business_license_choose'] === "later"){
}
if($data['business_license_choose'] === "non"){
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
$validator = Validator::make(Input::all(), []);
$validator->errors()->add('field', __('Bitte gib eine Begründung ein, warum Du keinen Gewerbeschein benötigst.'));
$user->wizard = 3;
$user->save();
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
}else{
$user->account->setNotice('business_license_reason', $data['non_business_license_reason']);
}
}
$user->account->setNotice('business_license', $data['business_license_choose']);
$user->wizard = 4;
$user->save();
return redirect(route('wizard_register'));
}
$this->fileRepo->_set('disk', 'user');
@ -297,6 +322,7 @@ class WizardController extends Controller
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
];
$user->wizard = 10;
$user->save();
@ -335,6 +361,7 @@ class WizardController extends Controller
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'products_on_board' => Product::where('active', true)->where('show_at', '=', 5)->orderBy('pos', 'ASC')->get(),
];
return view('user.wizard.create', $data)->withErrors($validator);
}
@ -395,6 +422,7 @@ class WizardController extends Controller
public function storePayment($step = 0){
if(Input::get('switchers-package-wizard')){
$user = User::find(Auth::user()->id);
Yard::instance('shopping')->destroy();
@ -405,13 +433,27 @@ class WizardController extends Controller
$user->abo_options = true;
$user->save();
}
if($product && $product->active && $product->show_at == 3){
//set membership product
$image = "";
if($product->images->count()){
$image = $product->images->first()->slug;
}
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
//set onboarding products
if(Input::get('products_on_board')){
foreach (Input::get('products_on_board') as $product_on_board_id){
$product_on_board = Product::find($product_on_board_id);
$image = "";
if($product_on_board->images->count()){
$image = $product_on_board->images->first()->slug;
}
Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->price, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]);
}
}
do {
$identifier = Util::getToken();
} while( ShoppingInstance::where('identifier', $identifier)->count() );