Berater Register, Mitgliedschat live

https://dev.adametz.media:3000/cliquers/mivita.care/issues/3
This commit is contained in:
Kevin Adametz 2020-03-09 14:45:09 +01:00
parent 21abafb8db
commit 1ada368ed4
43 changed files with 286 additions and 114 deletions

View file

@ -110,6 +110,11 @@ class AdminUserController extends Controller
$user->payment_shop = \Carbon::parse(str_replace("- ", "", $data['payment_shop']));
}
}
if(isset($data['save-test_mode'])){
$user->test_mode = isset($data['test_mode']) ? true : false;;
}
$user->save();
\Session()->flash('alert-save', true);

View file

@ -112,6 +112,7 @@ class PayoneController extends Controller
'key' => $data['key'],
'txaction' => $data['txaction'],
'transmitted_data' => Util::utf8ize($data),
'mode' => $data['mode'],
]);
$shopping_order->txaction = $data['txaction'];
@ -179,13 +180,22 @@ class PayoneController extends Controller
$billing_email = $shopping_order->shopping_user->billing_email;
$user_shop_email = $shopping_order->user_shop->user->email;
if(!$billing_email){
$billing_email = config('app.checkout_mail');
if($data['mode'] === 'test'){
$billing_email = config('app.checkout_test_mail');
}else{
$billing_email = config('app.checkout_mail');
}
}
$checkout_mail = config('app.checkout_mail');
if($user_shop_email){
Mail::to($billing_email)->bcc([$user_shop_email, $checkout_mail])->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $send_link));
if($data['mode'] === 'test'){
$checkout_mail = config('app.checkout_test_mail');
}else{
Mail::to($billing_email)->bcc($checkout_mail)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $send_link));
$checkout_mail = config('app.checkout_mail');
}
if($user_shop_email){
Mail::to($billing_email)->bcc([$user_shop_email, $checkout_mail])->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $send_link, $data['mode']));
}else{
Mail::to($billing_email)->bcc($checkout_mail)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $send_link, $data['mode']));
}
print("TSOK");

View file

@ -28,7 +28,10 @@ class CronController extends Controller
public function index()
{
$this->checkConfirmation();
//$this->checkConfirmation();
//TODO
//SEPA Booking
//Mail reminder
}
/**

View file

@ -75,12 +75,17 @@ class DataTableController extends Controller
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>';
})
->addColumn('test_mode', function (User $user) {
$link = '<a href="#" data-toggle="modal" data-target="#modals-test_mode" data-id="'.$user->id.'" data-email="'.$user->email.'" data-test_mode="'.$user->test_mode.'">';
return $user->test_mode ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
})
->orderColumn('id', 'id $1')
->orderColumn('confirmed', 'confirmed $1')
->orderColumn('active', 'active $1')
->orderColumn('shop', 'shop $1')
->orderColumn('admin', 'active $1')
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'action_delete'])
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'test_mode', 'action_delete'])
->make(true);
}
}

View file

@ -145,7 +145,11 @@ class MembershipController extends Controller
if(Input::get('delete_membership_mivita')){
//TODO
$user = User::find(Auth::user()->id);
$mail = config('app.info_mail');
if($user->isTestMode()){
$mail = config('app.info_test_mail');
}else{
$mail = config('app.info_mail');
}
Mail::to($mail)->send(new MailInfo($user, 'delete_membership'));
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>50]);
\Session()->flash('alert-success', "Mitgliedschaft beenden ist beantragt");

View file

@ -105,8 +105,10 @@ class PayoneController extends Controller
'reference' => $this->reference,
'amount' => $amount,
'currency' => $currency,
'mode' => $this->shopping_order->mode,
]);
$this->default['mode'] = $this->shopping_order->mode;
return $this->reference;
}
@ -232,6 +234,7 @@ class PayoneController extends Controller
'errormessage' => $response['errormessage'],
'customermessage' => $response['customermessage'],
'status' => $response['status'],
'mode' => $this->shopping_payment->mode,
]);
Util::setUserHistoryValue(['status'=>3]);
\Session::flash('errormessage', $response['errormessage']);
@ -247,6 +250,8 @@ class PayoneController extends Controller
'txid' => $response['txid'],
'userid' => $response['userid'],
'status' => $response['status'],
'mode' => $this->shopping_payment->mode,
]);
Util::setUserHistoryValue(['status'=>4]);
return redirect()->away($response["redirecturl"]);
@ -263,6 +268,8 @@ class PayoneController extends Controller
'userid' => $response['userid'],
'status' => $response['status'],
'transmitted_data' => $response,
'mode' => $this->shopping_payment->mode,
]);
Util::setUserHistoryValue(['status'=>5]);
if($payt->shopping_payment->clearingtype === "vor"){

View file

@ -6,6 +6,7 @@ namespace App\Http\Controllers;
use App\Models\Country;
use App\Models\ShoppingOrder;
use App\Models\UserShop;
use Input;
@ -45,7 +46,7 @@ class SalesController extends Controller
public function usersDatatable(){
$query = ShoppingOrder::with('shopping_user')->where('shopping_orders.auth_user_id', '!=', NULL);
$query = ShoppingOrder::with('shopping_user', 'user_shop')->where('shopping_orders.auth_user_id', '!=', NULL);
return \DataTables::eloquent($query)
->addColumn('billing_firstname', function (ShoppingOrder $ShoppingOrder) {
@ -61,6 +62,9 @@ class SalesController extends Controller
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) {
@ -72,6 +76,12 @@ class SalesController extends Controller
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain().'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain().'</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>' : '-';
})
->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>';
})
@ -92,7 +102,7 @@ class SalesController extends Controller
->orderColumn('txaction', 'txaction $1')
->orderColumn('user_shop_id', 'user_shop_id $1')
->rawColumns(['id', 'txaction', 'user_shop_id'])
->rawColumns(['id', 'txaction', 'user_shop_id', 'auth_user_shop'])
->make(true);
}
@ -137,6 +147,9 @@ class SalesController extends Controller
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) {

View file

@ -88,6 +88,7 @@ class CheckoutController extends Controller
$data = [
'user_shop' => Util::getUserShop(),
'shopping_user' => $shopping_user,
'shopping_mode' => Util::getUserShoppingMode(),
];
return view('web.templates.checkout', $data);
}
@ -329,6 +330,7 @@ class CheckoutController extends Controller
'tax' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ','),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ','),
'weight' => Yard::instance('shopping')->weight(),
'mode' => Util::getUserShoppingMode(),
];
$shopping_order= false;
if($this->getPayments('shopping_order_id')){

View file

@ -7,6 +7,7 @@ use App\Models\File;
use App\Models\Product;
use App\Models\ShoppingInstance;
use App\Models\UserAccount;
use App\Models\UserHistory;
use App\Repositories\FileRepository;
use App\Services\Util;
use App\User;
@ -51,12 +52,16 @@ class WizardController extends Controller
$step = !$user->wizard ? 0 : $user->wizard;
if($step >= 20){
return redirect('/');
return redirect('/home');
}
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
$data = [
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
if($step == 15){
@ -83,7 +88,7 @@ class WizardController extends Controller
$step = !$user->wizard ? 0 : $user->wizard;
if($step >= 10){
return redirect('/');
return redirect('/home');
}
$data = [
'user' => Auth::user(),
@ -111,10 +116,14 @@ class WizardController extends Controller
return redirect(route('wizard_payment'));
}
$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(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
if($user->wizard == 20){
@ -137,7 +146,6 @@ class WizardController extends Controller
}
if ($step == 0) {
$rules = array(
'accepted_data_protection' => 'required',
'accepted_active' => 'required',
@ -244,11 +252,16 @@ class WizardController extends Controller
}
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));
if($user->isTestMode()){
$mail = config('app.info_test_mail');
}else{
$mail = config('app.info_mail');
}
Mail::to($mail)->send(new MailReleaseAccount($user));
return redirect(route('wizard_register'));
}
@ -371,13 +384,16 @@ class WizardController extends Controller
}
}
public function storePayment($step = 0){
if(Input::get('switchers-package-wizard')){
$user = Auth::user();
$user = User::find(Auth::user()->id);
Yard::instance('shopping')->destroy();
$product = Product::find(Input::get('switchers-package-wizard'));
$showAboOptions = false;
if(Input::get('abo_options')){
$showAboOptions = true;
$user->abo_options = true;
$user->save();
}
@ -396,7 +412,7 @@ class WizardController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
'payment' => 4,
'payment' => 4, //Berater Wizard
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
@ -404,6 +420,7 @@ class WizardController extends Controller
Yard::instance('shopping')->store($identifier);
//add to DB
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'wizard_payment', 'status'=>1, 'product_id'=>$product->id, 'identifier'=>$identifier, 'abo_options'=>$showAboOptions]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);