01 2020
This commit is contained in:
parent
f117f79bb9
commit
3711fcc8d0
101 changed files with 4027 additions and 918 deletions
|
|
@ -125,11 +125,11 @@ class PayoneController extends Controller
|
|||
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
foreach ($shopping_order_item->product->action as $do){
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_account'){
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_account'){
|
||||
$user->payment_account = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_shop'){
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop'){
|
||||
$user->payment_shop = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
|
|
@ -144,6 +144,7 @@ class PayoneController extends Controller
|
|||
if($data['txaction'] == 'appointed'){
|
||||
|
||||
}
|
||||
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
$user_shop_email = $shopping_order->user_shop->user->email;
|
||||
if(!$billing_email){
|
||||
|
|
|
|||
|
|
@ -25,25 +25,25 @@ class DataTableController extends Controller
|
|||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-default" data-id="'.$user->id.'" data-email="'.$user->email.'" data-admin="'.$user->admin.'" data-active="'.$user->active.'" data-confirmed="'.$user->confirmed.'">'.HTMLHelper::getRoleLabel($user->admin).'</a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('shop', function (User $user) {
|
||||
if($user->shop){
|
||||
if($user->shop->active){
|
||||
return '<span class="badge badge-pill badge-success"><i class="far fa-check"></i> active</span>';
|
||||
return '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> active</span>';
|
||||
}
|
||||
return'<span class="badge badge-pill badge-success"><i class="far fa-check"></i> deactive</span>';
|
||||
return'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> deactive</span>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('since', function (User $user) {
|
||||
if($user->shop){
|
||||
|
|
@ -55,8 +55,8 @@ class DataTableController extends Controller
|
|||
return "-";
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="far fa-trash"></span></a>
|
||||
<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="far fa-sign-in-alt"></span></a>';
|
||||
return '<a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>
|
||||
<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ class HomeController extends Controller
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
||||
public function index()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
|
|
@ -55,28 +51,28 @@ class HomeController extends Controller
|
|||
$target = Input::get('target');
|
||||
|
||||
$response = "";
|
||||
if($data == "data_protection"){
|
||||
if($data === "data_protection"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.data_protect_de', $data)->render();
|
||||
}
|
||||
if($data == "imprint"){
|
||||
if($data === "imprint"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.imprint_de', $data)->render();
|
||||
}
|
||||
if($data == "shop_term_of_use"){
|
||||
if($data === "shop_term_of_use"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
$response = view('legal.shop_term_of_use_de', $data)->render();
|
||||
}
|
||||
if($data == "agb"){
|
||||
if($data === "agb"){
|
||||
$data = [
|
||||
'modal' => true,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
|
|
@ -169,13 +165,13 @@ class HomeController extends Controller
|
|||
|
||||
if ( ! $user)
|
||||
{
|
||||
|
||||
// return redirect('/status/not/found');
|
||||
return redirect('/home');
|
||||
|
||||
return redirect('/status/not/found');
|
||||
}
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_date = now();
|
||||
if($user->confirmed === 0){
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_date = now();
|
||||
}
|
||||
|
||||
// $user->confirmation_code = null;
|
||||
// $user->confirmation_code_to = null;
|
||||
// $user->confirmation_code_remider = 0;
|
||||
|
|
@ -207,7 +203,7 @@ class HomeController extends Controller
|
|||
public function checkMail(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['user_id'] == "new"){
|
||||
if($data['user_id'] === "new"){
|
||||
if(User::where('email', $data['email'])->count()){
|
||||
return json_encode(false);
|
||||
}
|
||||
|
|
@ -228,9 +224,9 @@ class HomeController extends Controller
|
|||
|
||||
if($reference){
|
||||
$ShoppingPayment = ShoppingPayment::where('reference', $reference)->first();
|
||||
if($ShoppingPayment->status == 'success'){
|
||||
if($ShoppingPayment && $ShoppingPayment->status === 'success'){
|
||||
$user = Auth::user();
|
||||
if($user->wizard < 4){
|
||||
if($user && $user->wizard < 4){
|
||||
$user->wizard = 4;
|
||||
$user->save();
|
||||
return redirect(route('wizard', [4]));
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Mail\MailVerifyContact;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -58,6 +61,7 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'user' => $user,
|
||||
'can_change_mail' => true,
|
||||
'm_data_load' => false,
|
||||
|
|
@ -96,6 +100,7 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'user' => $user,
|
||||
'm_data_load' => $m_data_load,
|
||||
'm_data_error' => $m_data_error,
|
||||
|
|
@ -112,6 +117,8 @@ class LeadController extends Controller
|
|||
{
|
||||
|
||||
$data = Input::all();
|
||||
$show = Input::get('show');
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
|
|
@ -155,7 +162,7 @@ class LeadController extends Controller
|
|||
$user_id = $user->id;
|
||||
}
|
||||
return redirect(route('admin_lead_edit', [$user_id]))->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
}
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$user = new User();
|
||||
|
|
@ -194,6 +201,9 @@ class LeadController extends Controller
|
|||
|
||||
$user->lang = $user->getLandByCountry();
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
//10 == start wizard form create Lead
|
||||
$user->wizard = 10;
|
||||
|
||||
$user->save();
|
||||
|
||||
|
||||
|
|
@ -204,28 +214,84 @@ class LeadController extends Controller
|
|||
}
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
return redirect(route('admin_lead_edit', [$user->id])."?show=".$show);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//user released when register is complete
|
||||
public function newReleased($id){
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
if(!$user->m_sponsor){
|
||||
$validator->errors()->add('m_sponsor', __('Berater hat keinen Sponsor.'));
|
||||
}
|
||||
if(!$user->account->m_first_name){
|
||||
$validator->errors()->add('m_first_name', __('Berater hat keinen Vornamen.'));
|
||||
}
|
||||
if(!$user->account->m_first_name){
|
||||
$validator->errors()->add('m_last_name', __('Berater hat keinen Nachnamen.'));
|
||||
}
|
||||
if(!$user->account->m_account){
|
||||
$validator->errors()->add('m_account', __('Berater hat keine Account ID'));
|
||||
}
|
||||
if ($validator->errors()->count()) {
|
||||
return back()->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
|
||||
//create PDF
|
||||
$pdf = new ContractPDFRepository($user);
|
||||
$pdf->_set('disk', 'user');
|
||||
$pdf->_set('dir', '/'.$user->id.'/documents/');
|
||||
$pdf->_set('user_id', $user->id);
|
||||
$pdf->_set('identifier', 'contract');
|
||||
$pdf->createContractPDF();
|
||||
|
||||
//set wizard tp payments
|
||||
$user->wizard = 20;
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
//mail with code to user?
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
\Session()->flash('alert-success', "Berater freigeschaltet!");
|
||||
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
|
||||
//send new verfified mail to user
|
||||
public function newMailVerified($id){
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
$unique = false;
|
||||
do{
|
||||
$confirmation_code = str_random(30);
|
||||
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
|
||||
$unique = true;
|
||||
}
|
||||
}
|
||||
while(!$unique);
|
||||
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
\Session()->flash('alert-success', "E-Mail erneut gesendet");
|
||||
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
|
||||
}
|
||||
|
||||
/* @if($user->payment_account )
|
||||
<p><span class="ion ion-md-checkmark-circle-outline text-primary"></span>
|
||||
<strong>{{__('Account aktiv')}}</strong> {{__('bis zum:')}} {{ $user->getPaymentAccountDateFormat() }}</p>
|
||||
@else
|
||||
<p><span class="ion ion-md-close-circle-outline text-danger"></span>
|
||||
<strong>{{__('Account inaktiv')}}</strong></p>
|
||||
@endif
|
||||
|
||||
@if($user->payment_shop)
|
||||
<p><span class="ion ion-md-checkmark-circle-outline text-primary"></span>
|
||||
<strong>{{__('Shop aktiv')}}</strong> {{__('bis zum')}}: {{ $user->getPaymentShopDateFormat() }}</p>
|
||||
@else
|
||||
<p><span class="ion ion-md-close-circle-outline text-danger"></span>
|
||||
<strong>{{__('Shop inaktiv')}}</strong></p>
|
||||
@endif*/
|
||||
public function getLeads()
|
||||
{
|
||||
|
||||
|
|
@ -242,22 +308,22 @@ class LeadController extends Controller
|
|||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account', function (User $user) {
|
||||
return $user->payment_account ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->payment_account ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
->addColumn('payment_shop', function (User $user) {
|
||||
return $user->payment_shop ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->payment_shop ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_shop_date', function (User $user) {
|
||||
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
|
||||
|
|
|
|||
|
|
@ -73,16 +73,16 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
})
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
/* ->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
@ -149,16 +149,16 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
})
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_sales_users_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
/* ->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="far fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="far fa-times"></i></span>';
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Input;
|
||||
use Validator;
|
||||
|
|
@ -86,7 +87,7 @@ class UserDataController extends Controller
|
|||
*/
|
||||
public function userDataStore(){
|
||||
|
||||
$user = Auth::user();
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ class UserUpdatePasswordController extends Controller
|
|||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.update_password')->withErrors($validator);
|
||||
|
||||
}else{
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
}
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('user_update_password'));
|
||||
|
|
@ -67,22 +67,18 @@ class UserUpdatePasswordController extends Controller
|
|||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function updatePasswordFirst(){
|
||||
if(!Auth::user()->isPasswort()){
|
||||
return view('user.update_password_first');
|
||||
}
|
||||
return redirect(route('user_update_password'));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the password for the user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function updatePasswordFirstStore(Request $request)
|
||||
{
|
||||
|
|
@ -100,12 +96,13 @@ class UserUpdatePasswordController extends Controller
|
|||
// redirect our user back to the form with the errors from the validator
|
||||
return view('user.update_password_first')->withErrors($validator);
|
||||
|
||||
}else{
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
}
|
||||
|
||||
$request->user()->fill([
|
||||
'password' => Hash::make($request->password)
|
||||
])->save();
|
||||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect('/home');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,6 @@ class CheckoutController extends Controller
|
|||
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
|
||||
}
|
||||
if($ret['elv']['status'] === 'APPROVED' && $ret['elv']['mandate_status'] !== "active"){
|
||||
dd($ret);
|
||||
\Session::flash('elv-managemandate', 1);
|
||||
\Session::flash('elv-mandate_identification', $ret['elv']['mandate_identification']);
|
||||
\Session::flash('elv-mandate_text', $ret['elv']['mandate_text']);
|
||||
|
|
@ -198,7 +197,7 @@ class CheckoutController extends Controller
|
|||
if(Input::get('payment_method') === 'elv' && Input::get('mandate_identification')) {
|
||||
$ret['elv']['mandate_identification'] = Input::get('mandate_identification');
|
||||
$ret['elv']['creditor_identifier'] = Input::get('creditor_identifier');
|
||||
$ret['elv']['iban'] = $data['iban'];
|
||||
$ret['elv']['iban'] = $data['elv_iban'];
|
||||
$ret['elv']['bic'] = $data['elv_bic'];
|
||||
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ class ContactController extends Controller
|
|||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
}
|
||||
|
||||
|
||||
$contact = [];
|
||||
$contact['first_name'] = Input::get('first_name');
|
||||
|
|
@ -78,8 +79,6 @@ class ContactController extends Controller
|
|||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.contact-final', $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
135
app/Http/Controllers/Web/RegisterController.php
Executable file
135
app/Http/Controllers/Web/RegisterController.php
Executable file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailContact;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Input;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\Util;
|
||||
use Validator;
|
||||
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
|
||||
private $GOOGLE_ReCAPTCHA_KEY = "6LeeZosUAAAAAG907fMMqO4BFgsiR4ANDodd8FlU";
|
||||
private $GOOGLE_ReCAPTCHA_SECRET = "6LeeZosUAAAAADIy2fyR4RG3EuM-Zdz7Pa2Qmb1J";
|
||||
|
||||
protected $userRepo;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct(UserRepository $userRepo)
|
||||
{
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
|
||||
}
|
||||
|
||||
public function register(){
|
||||
|
||||
|
||||
$rules = array(
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'salutation' => 'required',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'email-confirm' => 'required|same:email',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
'password_confirmation' => 'required|string|min:6',
|
||||
// 'g-recaptcha-response'=>'required|recaptcha',
|
||||
'accepted_data_protection' => 'required',
|
||||
);
|
||||
|
||||
/*Validator::extend('recaptcha', function($attribute, $value, $parameters, $validator) {
|
||||
return $this->reCaptcha_validate($attribute, $value, $parameters, $validator);
|
||||
});*/
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
$data = Input::all();
|
||||
$user = $this->userRepo->create($data);
|
||||
|
||||
$unique = false;
|
||||
do{
|
||||
$confirmation_code = str_random(30);
|
||||
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
|
||||
$unique = true;
|
||||
}
|
||||
}
|
||||
while(!$unique);
|
||||
|
||||
|
||||
$user->lang = !empty(\App::getLocale()) ? \App::getLocale() : "de";
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->m_sponsor = $user_shop->user->id;
|
||||
$user->m_level = 1;
|
||||
$user->save();
|
||||
|
||||
$user->account->data_protection = now();
|
||||
$user->account->save();
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
return redirect('/registrierung/finish');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function finish()
|
||||
{
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.registrierung_finish', $data);
|
||||
}
|
||||
/*
|
||||
private function reCaptcha_validate($attribute, $value, $parameters, $validator)
|
||||
{
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$response = $client->post(
|
||||
'https://www.google.com/recaptcha/api/siteverify',
|
||||
['form_params' =>
|
||||
[
|
||||
'secret' => $this->GOOGLE_ReCAPTCHA_SECRET,
|
||||
'response' => $value
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$body = json_decode((string)$response->getBody());
|
||||
return $body->success;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -63,8 +63,8 @@ class SiteController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if($site == 'produkte'){
|
||||
if($subsite || $subsite != 'alle-produkte') {
|
||||
if($site === 'produkte'){
|
||||
if($subsite || $subsite !== 'alle-produkte') {
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
if ($category) {
|
||||
$headline_image = false;
|
||||
|
|
|
|||
|
|
@ -2,35 +2,46 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\File;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Validator;
|
||||
use Yard;
|
||||
|
||||
class WizardController extends Controller
|
||||
{
|
||||
|
||||
protected $fileRepo;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(FileRepository $fileRepo)
|
||||
{
|
||||
$this->fileRepo = $fileRepo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function show($step = 0)
|
||||
public function create()
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
$user = Auth::user();
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
|
|
@ -38,7 +49,7 @@ class WizardController extends Controller
|
|||
return redirect(route('wizard'));
|
||||
}
|
||||
|
||||
$step = (!$user->wizard ? 0 : $user->wizard );
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
if($step == 10){
|
||||
return redirect('/');
|
||||
}
|
||||
|
|
@ -48,18 +59,178 @@ class WizardController extends Controller
|
|||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
|
||||
return view('user.wizard.show', $data);
|
||||
return view('user.wizard.create', $data);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
|
||||
public function store($step = 0)
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
return redirect(route('wizard'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
|
||||
if($step == 10){
|
||||
return redirect('/');
|
||||
}
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
if($step == 5){
|
||||
return view('user.wizard.register_release', $data);
|
||||
}
|
||||
|
||||
return view('user.wizard.register', $data);
|
||||
}
|
||||
|
||||
public function storeRegister($step = false)
|
||||
{
|
||||
|
||||
if (!Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if (!$user->account) {
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
||||
if ($step == 0) {
|
||||
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required',
|
||||
'accepted_active' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
$user->wizard = 0;
|
||||
$user->save();
|
||||
return view('user.wizard.register', $data)->withErrors($validator);
|
||||
}
|
||||
$account = $user->account;
|
||||
if($account->data_protection === null){
|
||||
$account->data_protection = now();
|
||||
}
|
||||
if($user->agreement === null){
|
||||
$user->agreement = now();
|
||||
}
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
if ($step == 1) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'address' => 'required',
|
||||
'zipcode' => 'required',
|
||||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday' => 'required',
|
||||
);
|
||||
|
||||
if (!Input::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
'shipping_address' => 'required',
|
||||
'shipping_zipcode' => 'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required',
|
||||
'shipping_country_id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
if ($step == 2) {
|
||||
if(Input::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'id_card');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
$user->wizard = 4;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
$this->fileRepo->_set('disk', 'user');
|
||||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'business_license');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
}
|
||||
|
||||
if ($step == 4) {
|
||||
|
||||
$user->wizard = 5;
|
||||
$user->release_account = now();
|
||||
$user->save();
|
||||
Mail::to('kevin@adametz.media')->bcc(['kevin.adametz@me.com'])->send(new MailReleaseAccount($user));
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
}
|
||||
|
||||
public function storeCreate($step = 0)
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}
|
||||
|
|
@ -76,6 +247,7 @@ class WizardController extends Controller
|
|||
'step' => $step,
|
||||
];
|
||||
return view('user.wizard.show', $data)->withErrors($validator);
|
||||
|
||||
}
|
||||
$account = $user->account;
|
||||
$account->data_protection = now();
|
||||
|
|
@ -207,9 +379,21 @@ class WizardController extends Controller
|
|||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
return redirect(route('wizard', [3]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function delete($id, $relation){
|
||||
|
||||
if($relation === 'upload'){
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
$file = $user->files()->findOrFail($id);
|
||||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue