Registierung Korrekturen
This commit is contained in:
parent
8e4bb0c2f6
commit
d8b5206031
70 changed files with 1192 additions and 569 deletions
|
|
@ -99,6 +99,7 @@ class AdminUserController extends Controller
|
|||
if(!isset($data['payment_account']) || $data['payment_account'] == ""){
|
||||
$user->payment_account = null;
|
||||
}else{
|
||||
$user->wizard = 100;
|
||||
$user->payment_account = \Carbon::parse(str_replace("- ", "", $data['payment_account']));
|
||||
}
|
||||
}
|
||||
|
|
@ -107,6 +108,7 @@ class AdminUserController extends Controller
|
|||
if(!isset($data['payment_shop']) || $data['payment_shop'] == ""){
|
||||
$user->payment_shop = null;
|
||||
}else{
|
||||
$user->wizard = 100;
|
||||
$user->payment_shop = \Carbon::parse(str_replace("- ", "", $data['payment_shop']));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,14 +157,12 @@ class PayoneController extends Controller
|
|||
$user->payment_account = $date;
|
||||
$user->wizard = 100;
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop'){
|
||||
$user->payment_order_id = $shopping_order_item->product->id; //35
|
||||
$user->payment_shop = $date;
|
||||
$user->wizard = 100;
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
|
|
@ -173,6 +171,11 @@ class PayoneController extends Controller
|
|||
$user->payment_shop = $user->payment_account; //same Date, is upgrade
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_lead_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
$user->m_level = $shopping_order_item->product->upgrade_to_id;
|
||||
}
|
||||
}
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ class CronController extends Controller
|
|||
$user->save();
|
||||
}
|
||||
}
|
||||
die("okay");
|
||||
|
||||
return "TOSK";
|
||||
}
|
||||
|
||||
public function checkPaymentsAccounts(){
|
||||
|
|
@ -92,51 +91,37 @@ class CronController extends Controller
|
|||
*/
|
||||
//max Date for reminder
|
||||
$renewalDate = Carbon::now()->modify('+'.(config('mivita.remind_first_days')+1).' days');
|
||||
dump($renewalDate);
|
||||
//dump($renewalDate);
|
||||
$users = User::where('payment_account', '!=', NULL)
|
||||
->where('active', '=', 1)
|
||||
->where('blocked', '!=', 1)
|
||||
->where('payment_account', '<', $renewalDate)
|
||||
->get();
|
||||
|
||||
|
||||
$user = User::find(2);
|
||||
|
||||
/* $this->checkReminderPayments($user);
|
||||
/* $user = User::find(2);
|
||||
$this->checkReminderPayments($user);
|
||||
dump($user->daysActiveAccount());
|
||||
dump($user->email." | ".$user->getPaymentAccountDateFormat());
|
||||
die();*/
|
||||
foreach ($users as $user){
|
||||
|
||||
|
||||
//$this->checkReminderPayments($user);
|
||||
|
||||
|
||||
// dump($user->nextRenewalAccount());
|
||||
//$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
|
||||
|
||||
//UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
|
||||
|
||||
dump($user->daysActiveAccount());
|
||||
$this->checkReminderPayments($user);
|
||||
/*dump($user->daysActiveAccount());
|
||||
dump($user->email." | ".$user->getPaymentAccountDateFormat());
|
||||
|
||||
dump('-------------------');*/
|
||||
}
|
||||
die("");
|
||||
return "TOSK";
|
||||
}
|
||||
|
||||
|
||||
private function checkReminderPayments(User $user){
|
||||
|
||||
|
||||
$isSend = $this->checkIsReminderSend($user, 31);
|
||||
/* $isSend = $this->checkIsReminderSend($user, 31);
|
||||
$isSend = $this->checkIsReminderSend($user, 32);
|
||||
$isSend = $this->checkIsReminderSend($user, 33);
|
||||
$isSend = $this->checkIsReminderSend($user, 34);
|
||||
$isSend = $this->checkIsReminderSend($user, 35);
|
||||
$isSend = $this->checkIsReminderSend($user, 36);
|
||||
|
||||
return ;
|
||||
|
||||
return ;*/
|
||||
|
||||
//35 reminder_deaktiv, 36 reminder_deaktiv_sepa
|
||||
if(!$user->isActiveAccount()){
|
||||
|
|
@ -170,7 +155,6 @@ class CronController extends Controller
|
|||
}
|
||||
$isSend = $this->checkIsReminderSend($user, 31);
|
||||
return $isSend;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +168,7 @@ class CronController extends Controller
|
|||
->get()->last();
|
||||
|
||||
if($isSend){
|
||||
// return true;
|
||||
return true;
|
||||
}
|
||||
$referenz = $this->sendReminderMail($user, $status);
|
||||
//is not sent create
|
||||
|
|
@ -200,9 +184,10 @@ class CronController extends Controller
|
|||
$days = $days*-1;
|
||||
}
|
||||
|
||||
//dump($days);
|
||||
//dump($status);
|
||||
$pay_date = Carbon::parse($user->payment_account)->modify('- '.config('mivita.abo_booking_days').' days')->format('d.m.Y');
|
||||
$datetime = $user->getPaymentAccountDateFormat();
|
||||
|
||||
$price = "";
|
||||
if($user->payment_order_id && isset($user->payment_order_product->price)){
|
||||
$price = 'von '.$user->payment_order_product->getFormattedPrice().' EUR';
|
||||
|
|
@ -222,9 +207,8 @@ class CronController extends Controller
|
|||
'url' => route('user_membership'),
|
||||
'button' => $button,
|
||||
];
|
||||
dump($data);
|
||||
//dump($data);
|
||||
$sender = User::find(1);
|
||||
|
||||
$customer_mail = UserMessage::create([
|
||||
'user_id' => $user->id,
|
||||
'send_user_id' => $sender->id,
|
||||
|
|
@ -232,9 +216,12 @@ class CronController extends Controller
|
|||
'subject' => $data['subject'],
|
||||
'message' => $data['message']." ".$data['message_last'],
|
||||
]);
|
||||
|
||||
try{
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
if($status >= 34){
|
||||
Mail::to($user->email)->bcc(config('app.default_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}else{
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}
|
||||
}
|
||||
catch(\Exception $e){
|
||||
\Log::channel('cron')->error('Mail Error: '.$e->getMessage());
|
||||
|
|
|
|||
|
|
@ -82,13 +82,12 @@ class LeadController extends Controller
|
|||
$m_data_load = false;
|
||||
$m_data_error = false;
|
||||
$data = Input::all();
|
||||
if(!isset($data['edit_m_data_key']) && $data['edit_m_data_key'] !== "mivita"){
|
||||
$m_data_error = "Der Key ist falsch.";
|
||||
if(!isset($data['edit_m_data_key']) && $data['edit_m_data_key'] !== config('mivita.edit_data_pass')){
|
||||
$m_data_error = "Das Passwort ist falsch.";
|
||||
}else{
|
||||
$m_data_load = true;
|
||||
}
|
||||
|
||||
|
||||
if($id === "new"){
|
||||
$user = new User();
|
||||
$user->account = new UserAccount();
|
||||
|
|
@ -102,12 +101,14 @@ class LeadController extends Controller
|
|||
$user->account = new UserAccount();
|
||||
}
|
||||
}
|
||||
$next_account_id = UserAccount::max('m_account') +1;
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'show' => 'check_lead',
|
||||
'user' => $user,
|
||||
'm_data_load' => $m_data_load,
|
||||
'm_data_error' => $m_data_error,
|
||||
'can_change_mail' => true,
|
||||
'next_account_id' => $next_account_id
|
||||
];
|
||||
return view('admin.lead.edit', $data);
|
||||
}
|
||||
|
|
@ -152,9 +153,14 @@ 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(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
|
||||
|
|
@ -164,7 +170,7 @@ class LeadController extends Controller
|
|||
$user = User::findOrFail($data['user_id']);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
return redirect(route('admin_lead_edit', [$user_id]))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('admin_lead_edit', [$user_id])."?show=".$show)->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
|
|
@ -181,7 +187,6 @@ class LeadController extends Controller
|
|||
|
||||
$this->userRepo->update($data);
|
||||
|
||||
|
||||
if(isset($data['m_data_edit']) && $data['m_data_edit'] === "TSOK"){
|
||||
$user = $this->userRepo->getModel();
|
||||
$user->m_level = isset($data['m_level']) ? $data['m_level'] : NULL;
|
||||
|
|
@ -277,7 +282,13 @@ class LeadController extends Controller
|
|||
'message' => $input['account_incomplete_message'],
|
||||
'confirmation_code' => $confirmation_code,
|
||||
];
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
dd("error");
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'released_incomplete', 'status'=>0]);
|
||||
\Session()->flash('alert-success', "E-Mail an Berater gesendet.");
|
||||
|
||||
|
|
@ -296,7 +307,14 @@ class LeadController extends Controller
|
|||
$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));
|
||||
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
dd("error");
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'new_mail_verified', 'status'=>0]);
|
||||
|
||||
\Session()->flash('alert-success', "E-Mail erneut gesendet");
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Models\Product;
|
|||
use App\Models\ProductImage;
|
||||
use App\Repositories\ProductRepository;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
|
@ -23,8 +24,18 @@ class ProductController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
if(Request::get('show_active_products')){
|
||||
\Auth::user()->setSetting(['show_active_products' => Request::get('show_active_products')]);
|
||||
}
|
||||
if(\Auth::user()->getSetting('show_active_products') === "true"){
|
||||
$values = Product::where('active', true)->orderBy('pos', 'DESC')->orderBy('id', 'DESC')->get();
|
||||
|
||||
}else{
|
||||
$values = Product::orderBy('pos', 'DESC')->orderBy('id', 'DESC')->get();
|
||||
|
||||
}
|
||||
$data = [
|
||||
'values' => Product::orderBy('pos', 'DESC')->orderBy('id', 'DESC')->get(),
|
||||
'values' => $values
|
||||
];
|
||||
return view('admin.product.index', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,6 @@ class SalesController extends Controller
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function users()
|
||||
{
|
||||
$data = [
|
||||
|
|
@ -31,19 +27,14 @@ class SalesController extends Controller
|
|||
return view('admin.sales.users', $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function usersDetail()
|
||||
{
|
||||
$data = [
|
||||
// 'values' => Country::all(),
|
||||
];
|
||||
return view('admin.sales.index', $data);
|
||||
return view('admin.sales.user_detail', $data);
|
||||
}
|
||||
|
||||
|
||||
public function usersDatatable(){
|
||||
|
||||
$query = ShoppingOrder::with('shopping_user', 'user_shop')->where('shopping_orders.auth_user_id', '!=', NULL);
|
||||
|
|
@ -74,12 +65,12 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
})
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
|
||||
})
|
||||
->addColumn('auth_user_shop', function (ShoppingOrder $ShoppingOrder) {
|
||||
$auth_user_shop = UserShop::whereUserId($ShoppingOrder->auth_user_id)->first();
|
||||
|
||||
return $auth_user_shop ? '<a href="'.$auth_user_shop->getSubdomain().'" target="_blank">'.$auth_user_shop->getSubdomain().'</span>' : '-';
|
||||
return $auth_user_shop ? '<a href="'.$auth_user_shop->getSubdomain(false).'" target="_blank">'.$auth_user_shop->getSubdomain(false).'</span>' : '-';
|
||||
})
|
||||
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
|
|
@ -106,10 +97,6 @@ class SalesController extends Controller
|
|||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function customers()
|
||||
{
|
||||
$data = [
|
||||
|
|
@ -118,15 +105,12 @@ class SalesController extends Controller
|
|||
return view('admin.sales.customers', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function customersDetail()
|
||||
{
|
||||
$data = [
|
||||
// 'values' => Country::all(),
|
||||
];
|
||||
return view('admin.sales.index', $data);
|
||||
return view('admin.sales.customer_detail', $data);
|
||||
}
|
||||
|
||||
public function customersDatatable(){
|
||||
|
|
@ -159,7 +143,7 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
})
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</span>' : '';
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</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="fa fa-edit"></span></a>';
|
||||
|
|
|
|||
91
app/Http/Controllers/User/ShopSalesController.php
Executable file
91
app/Http/Controllers/User/ShopSalesController.php
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\User;
|
||||
|
||||
|
||||
class ShopSalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.shop');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('user.shop.sales.orders', $data);
|
||||
}
|
||||
|
||||
public function orderDetail()
|
||||
{
|
||||
$data = [
|
||||
// 'values' => Country::all(),
|
||||
];
|
||||
return view('admin.sales.customer_detail', $data);
|
||||
}
|
||||
|
||||
public function ordersDatatable(){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->where('user_shop_id', $user->shop->id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('billing_firstname', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_firstname : '';
|
||||
})
|
||||
->addColumn('billing_lastname', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_lastname : '';
|
||||
})
|
||||
->addColumn('billing_email', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_email : '';
|
||||
})
|
||||
->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->created_at->format("d.m.Y");
|
||||
})
|
||||
->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->mode === 'test'){
|
||||
return '<span class="badge badge-pill badge-default">TEST - '.$ShoppingOrder->getFormattedTxaction().'</span>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getFormattedTxactionColor().'">'.$ShoppingOrder->getFormattedTxaction().'</span>';
|
||||
})
|
||||
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getFormattedTotalShipping();
|
||||
})
|
||||
->addColumn('orders', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
})
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</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="fa fa-edit"></span></a>';
|
||||
})
|
||||
/* ->addColumn('confirmed', function (User $user) {
|
||||
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="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="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')
|
||||
->orderColumn('agreement', 'agreement $1')
|
||||
*/
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('user_shop_id', 'user_shop_id $1')
|
||||
->rawColumns(['id', 'txaction', 'user_shop_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
31
app/Http/Controllers/User/TeamController.php
Executable file
31
app/Http/Controllers/User/TeamController.php
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.shop');
|
||||
}
|
||||
|
||||
public function members()
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if($user->isActiveShop() && $user->shop){
|
||||
$shop_register_link = $user->shop->getSubdomain(false)."/reg";
|
||||
}else{
|
||||
$member_id = 'm'.($user->id + config('mivita.add_number_id'));
|
||||
$shop_register_link = config('app.protocol').config('app.domain').config('app.tld_care').'/reg/'.$member_id;
|
||||
}
|
||||
$data = [
|
||||
'shop_register_link' => $shop_register_link
|
||||
];
|
||||
return view('user.team.members', $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,14 +38,29 @@ class RegisterController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
}
|
||||
|
||||
public function member($member_id = false)
|
||||
{
|
||||
if(!$member_id){
|
||||
return redirect('/registrierung');
|
||||
}
|
||||
$user_id = (int) str_replace('m', '', $member_id) - config('mivita.add_number_id');
|
||||
$user = User::find($user_id);
|
||||
if(!$user || !$user->isActive() || !$user->isActiveAccount()){
|
||||
return redirect('/registrierung');
|
||||
}
|
||||
$data = [
|
||||
'GOOGLE_ReCAPTCHA_KEY' => $this->GOOGLE_ReCAPTCHA_KEY,
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'from_member_id' => $member_id
|
||||
];
|
||||
return view('web.templates.registrierung', $data);
|
||||
}
|
||||
|
||||
public function register(){
|
||||
|
|
@ -78,12 +93,18 @@ class RegisterController extends Controller
|
|||
$user = $this->userRepo->create($data);
|
||||
|
||||
$confirmation_code = UserService::createConfirmationCode();
|
||||
|
||||
$m_sponsor_id = 1;
|
||||
if($user_shop){
|
||||
$m_sponsor_id = $user_shop->user->id;
|
||||
}
|
||||
if(isset($data['from_member_id'])){
|
||||
$m_sponsor_id = (int) str_replace('m', '', $data['from_member_id']) - config('mivita.add_number_id');
|
||||
}
|
||||
$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_sponsor = $m_sponsor_id;
|
||||
$user->m_level = 1;
|
||||
$user->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -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() );
|
||||
|
|
|
|||
|
|
@ -30,10 +30,16 @@ class MailCheckout extends Mailable
|
|||
$this->send_link = $send_link;
|
||||
$this->mode = $mode;
|
||||
|
||||
$this->subject = __('email.checkout_subject')." mivita.care";
|
||||
if($shopping_order->user_shop){
|
||||
$this->subject = __('email.checkout_subject')." ".$shopping_order->user_shop->slug.'.mivita.care';
|
||||
if($this->txaction === 'paid'){
|
||||
$this->subject = __('email.checkout_subject_paid')." ";
|
||||
}else{
|
||||
$this->subject = __('email.checkout_subject')." ";
|
||||
}
|
||||
|
||||
if($shopping_order->user_shop){
|
||||
$this->subject .= $shopping_order->user_shop->slug.".";
|
||||
}
|
||||
$this->subject .= "mivita.care";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@ class Product extends Model
|
|||
'' => '-',
|
||||
'show_upgrade' => 'Kann gepdatet werden',
|
||||
'show_order' => 'Wird immer als Option angezeigt',
|
||||
'upgrade' => 'Produktupgrade zur Upgrade to ID',
|
||||
'upgrade' => 'Produktupgrade zur Produkt ID',
|
||||
'upgrade_member' => 'Beraterupgrade zur Karriere ID',
|
||||
|
||||
];
|
||||
public $unitTypes = [
|
||||
0 => '',
|
||||
|
|
@ -178,6 +180,8 @@ class Product extends Model
|
|||
0 => 'payment_for_account',
|
||||
1 => 'payment_for_shop',
|
||||
2 => 'payment_for_shop_upgrade',
|
||||
4 => 'payment_for_lead_upgrade',
|
||||
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
|
|
@ -258,11 +262,11 @@ class Product extends Model
|
|||
$unit = $this->attributes['unit'];
|
||||
//ml g
|
||||
if($unit === 1 || $unit === 2){
|
||||
return Util::formatNumber($price) . ' € 100/'.$this->getUnitType();
|
||||
return Util::formatNumber($price) . ' € / 100 '.$this->getUnitType();
|
||||
}
|
||||
//l kg
|
||||
if($unit === 3 || $unit === 4){
|
||||
return Util::formatNumber($price) . ' € 1/'.$this->getUnitType();
|
||||
return Util::formatNumber($price) . ' € / 1 '.$this->getUnitType();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -123,11 +123,13 @@ class UserAccount extends Model
|
|||
'm_account', 'm_salutation', 'm_first_name', 'm_last_name', 'm_notes', 'company', 'salutation', 'first_name', 'last_name', 'address', 'address_2', 'zipcode', 'city', 'country_id', 'pre_phone_id', 'phone', 'pre_mobil_id', 'mobil',
|
||||
'tax_number', 'tax_identification_number', 'taxable_sales', 'same_as_billing',
|
||||
'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_country_id', 'shipping_pre_phone_id', 'shipping_phone',
|
||||
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram'
|
||||
'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram', 'notice'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'payment_data' => 'array',
|
||||
'notice' => 'array',
|
||||
|
||||
];
|
||||
|
||||
use SoftDeletes;
|
||||
|
|
@ -202,7 +204,15 @@ class UserAccount extends Model
|
|||
return "";
|
||||
}
|
||||
|
||||
public function setNotice($key, $value){
|
||||
$notice = $this->notice;
|
||||
$notice[$key] = $value;
|
||||
$this->notice = $notice;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
|
||||
public function getNotice($key){
|
||||
return isset($this->notice[$key]) ? $this->notice[$key] : false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ class UserShop extends Model
|
|||
return Carbon::parse($this->attributes['active_date'])->format("d.m.Y");
|
||||
}
|
||||
|
||||
public function getSubdomain()
|
||||
public function getSubdomain($session=true)
|
||||
{
|
||||
if(\Session::has('user_shop_domain')){
|
||||
if($session && \Session::has('user_shop_domain')){
|
||||
return \Session::get('user_shop_domain');
|
||||
}
|
||||
return config('app.protocol').$this->attributes['slug'].".".config('app.domain').config('app.tld_care');
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class ContractPDFRepository extends BaseRepository {
|
|||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->m_first_name." ".$this->model->user_sponsor->account->m_last_name);
|
||||
|
||||
$website = $this->model->user_sponsor->shop()->count() ? $this->model->user_sponsor->shop->getSubdomain() : "www.mivita.care";
|
||||
$website = $this->model->user_sponsor->shop()->count() ? $this->model->user_sponsor->shop->getSubdomain(false) : "www.mivita.care";
|
||||
|
||||
}else{
|
||||
$website = "www.mivita.care";
|
||||
|
|
|
|||
23
app/User.php
23
app/User.php
|
|
@ -114,10 +114,15 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
protected $fillable = [
|
||||
'email', 'password', 'token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'settings' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
|
|
@ -242,6 +247,10 @@ class User extends Authenticatable
|
|||
public function isAboOption(){
|
||||
return ($this->abo_options && $this->account && $this->account->payment_data) ? true : false;
|
||||
}
|
||||
|
||||
public function isActive(){
|
||||
return ($this->active == 1 && $this->blocked == 0) ? true : false;
|
||||
}
|
||||
public function isActiveAccount(){
|
||||
return $this->payment_account ? Carbon::parse($this->payment_account)->gt(Carbon::now()) : false;
|
||||
}
|
||||
|
|
@ -336,8 +345,20 @@ class User extends Authenticatable
|
|||
}
|
||||
|
||||
|
||||
public function setSetting(array $revisions, bool $save = true){
|
||||
if(!$this->settings){
|
||||
$this->settings = [];
|
||||
}
|
||||
$this->settings = array_merge($this->settings, $revisions);
|
||||
if ($save) {
|
||||
$this->save();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getSetting($key, $default = null){
|
||||
return isset($this->settings[$key]) ? $this->settings[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -7,3 +7,10 @@ if (! function_exists('make_old_url')) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('make_old_url')) {
|
||||
function make_old_url($path)
|
||||
{
|
||||
return config('app.old_url').$path;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue