main system
This commit is contained in:
parent
0baac018a2
commit
a96d7d5c77
115 changed files with 4589 additions and 557 deletions
|
|
@ -90,7 +90,7 @@ class CronController extends Controller
|
|||
== 7 abo_booking_days + sepa + cron = 37 reminder_collect_sepa
|
||||
*/
|
||||
//max Date for reminder
|
||||
$renewalDate = Carbon::now()->modify('+'.(config('mivita.remind_first_days')+1).' days');
|
||||
$renewalDate = Carbon::now()->modify('+'.(config('main.remind_first_days')+1).' days');
|
||||
//dump($renewalDate);
|
||||
$users = User::where('payment_account', '!=', NULL)
|
||||
->where('active', '=', 1)
|
||||
|
|
@ -134,13 +134,13 @@ class CronController extends Controller
|
|||
}
|
||||
|
||||
//34 reminder_last
|
||||
if($user->daysActiveAccount() <= config('mivita.remind_last_days')){
|
||||
if($user->daysActiveAccount() <= config('main.remind_last_days')){
|
||||
$isSend = $this->checkIsReminderSend($user, 34);
|
||||
return $isSend;
|
||||
}
|
||||
|
||||
//33 reminder_sec
|
||||
if($user->daysActiveAccount() <= config('mivita.remind_sec_days')){
|
||||
if($user->daysActiveAccount() <= config('main.remind_sec_days')){
|
||||
if(!$user->isAboOption()){
|
||||
$isSend = $this->checkIsReminderSend($user, 33);
|
||||
return $isSend;
|
||||
|
|
@ -148,7 +148,7 @@ class CronController extends Controller
|
|||
}
|
||||
|
||||
//31 reminder_first, 32 reminder_first_sepa
|
||||
if($user->daysActiveAccount() > config('mivita.remind_sec_days')){
|
||||
if($user->daysActiveAccount() > config('main.remind_sec_days')){
|
||||
if($user->isAboOption()){
|
||||
$isSend = $this->checkIsReminderSend($user, 32);
|
||||
return $isSend;
|
||||
|
|
@ -186,7 +186,7 @@ class CronController extends Controller
|
|||
|
||||
//dump($days);
|
||||
//dump($status);
|
||||
$pay_date = Carbon::parse($user->payment_account)->modify('- '.config('mivita.abo_booking_days').' days')->format('d.m.Y');
|
||||
$pay_date = Carbon::parse($user->payment_account)->modify('- '.config('main.abo_booking_days').' days')->format('d.m.Y');
|
||||
$datetime = $user->getPaymentAccountDateFormat();
|
||||
$price = "";
|
||||
if($user->payment_order_id && isset($user->payment_order_product->price)){
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class HomeController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
// $this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +46,7 @@ class HomeController extends Controller
|
|||
'user' => Auth::user(),
|
||||
'now' => Carbon::now(),
|
||||
];
|
||||
return view('home', $data);
|
||||
return view('dashboard', $data);
|
||||
}
|
||||
|
||||
public function loadingModal(){
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use App\Models\Ingredient;
|
|||
use App\Models\IqImage;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductIngredient;
|
||||
use\Request;
|
||||
use Request;
|
||||
|
||||
|
||||
class IngredientController extends Controller
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use App\Models\UserAccount;
|
|||
use App\Models\UserHistory;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\SysLog;
|
||||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -258,7 +259,17 @@ class LeadController extends Controller
|
|||
$user->save();
|
||||
|
||||
//mail with code to user?
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('released', 'admin_lead', 5)
|
||||
->setUserId($user->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setMessage('Error send released E-Mail: '.$e->getMessage())
|
||||
->save();
|
||||
}
|
||||
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
|
||||
\Session()->flash('alert-success', "Berater freigeschaltet!");
|
||||
}
|
||||
|
|
@ -285,8 +296,11 @@ class LeadController extends Controller
|
|||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
dd("error");
|
||||
SysLog::action('released_incomplete', 'admin_lead', 5)
|
||||
->setUserId($user->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setMessage('Error send released_incomplete E-Mail: '.$e->getMessage())
|
||||
->save();
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'released_incomplete', 'status'=>0]);
|
||||
\Session()->flash('alert-success', "E-Mail an Berater gesendet.");
|
||||
|
|
@ -311,8 +325,11 @@ class LeadController extends Controller
|
|||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
dd("error");
|
||||
SysLog::action('new_mail_verified', 'admin_lead', 5)
|
||||
->setUserId($user->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setMessage('Error send new_mail_verified E-Mail: '.$e->getMessage())
|
||||
->save();
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'new_mail_verified', 'status'=>0]);
|
||||
|
||||
|
|
@ -321,7 +338,6 @@ class LeadController extends Controller
|
|||
|
||||
}
|
||||
|
||||
|
||||
public function deleteFile($user_id, $file_id, $relation){
|
||||
|
||||
if($relation === 'upload'){
|
||||
|
|
@ -369,12 +385,12 @@ class LeadController extends Controller
|
|||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
->addColumn('payment_shop', function (User $user) {
|
||||
/*->addColumn('payment_shop', function (User $user) {
|
||||
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) : "-";
|
||||
})
|
||||
})*/
|
||||
->addColumn('turnover', function (User $user) {
|
||||
return "-";
|
||||
})
|
||||
|
|
@ -389,8 +405,8 @@ class LeadController extends Controller
|
|||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('agreement', 'agreement $1')
|
||||
->orderColumn('payment_account', 'payment_account $1')
|
||||
->orderColumn('payment_shop', 'payment_shop $1')
|
||||
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account', 'payment_shop'])
|
||||
//->orderColumn('payment_shop', 'payment_shop $1')
|
||||
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ use App\Mail\MailInfo;
|
|||
use App\Models\Product;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserLevel;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Carbon;
|
||||
|
|
@ -43,7 +44,6 @@ class MembershipController extends Controller
|
|||
$userHistoryUpgradeOrder = UserHistory::whereUserId($user->id)->whereAction('upgrade_order')->get()->last();
|
||||
$userHistoryDeleteMembership = UserHistory::whereUserId($user->id)->whereAction('delete_membership')->whereStatus(50)->get()->last();
|
||||
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
|
|
@ -52,19 +52,22 @@ class MembershipController extends Controller
|
|||
'userHistoryPaymentOrder' => $userHistoryPaymentOrder,
|
||||
'userHistoryUpgradeOrder' => $userHistoryUpgradeOrder,
|
||||
'userHistoryDeleteMembership' => $userHistoryDeleteMembership,
|
||||
'user_levels' => UserLevel::where('active', true)->get(),
|
||||
|
||||
];
|
||||
return view('user.membership.index', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function storePayment($action){
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
|
||||
//#### remove_abo
|
||||
if($action === "remove_abo"){
|
||||
/*if($action === "remove_abo"){
|
||||
if(Request::get('abo_options_remove')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user->abo_options = false;
|
||||
|
|
@ -77,10 +80,10 @@ class MembershipController extends Controller
|
|||
}
|
||||
\Session()->flash('alert-error', "Fehler, Checkbox nicht bestätigt.");
|
||||
return back();
|
||||
}
|
||||
}*/
|
||||
//#### payment order
|
||||
//#### shop upgrade
|
||||
if($action === "upgrade_order" || $action === "payment_order"){
|
||||
/*if($action === "upgrade_order" || $action === "payment_order"){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
|
|
@ -126,8 +129,9 @@ class MembershipController extends Controller
|
|||
return redirect()->secure($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
if($action === "change_order"){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
|
@ -146,8 +150,22 @@ class MembershipController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if($action === "change_level"){
|
||||
if(Request::get('switchers-package-level')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user->next_m_level = Request::get('switchers-package-level');
|
||||
$user->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>10, 'referenz'=>Request::get('switchers-package-level')]);
|
||||
\Session()->flash('alert-success', "Änderung gespeichert");
|
||||
return back();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($action === "delete_membership"){
|
||||
if(Request::get('delete_membership_mivita')){
|
||||
if(Request::get('delete_membership')){
|
||||
//TODO
|
||||
$user = User::find(Auth::user()->id);
|
||||
if($user->isTestMode()){
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class PayController extends Controller
|
|||
}
|
||||
|
||||
//Rechnungskauf
|
||||
if($payment_method[0] === 'fnc'){
|
||||
if($payment_method === 'fnc'){
|
||||
$this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
|
|
@ -157,7 +157,7 @@ class PayController extends Controller
|
|||
]);
|
||||
|
||||
|
||||
Util::setUserHistoryValue(['status'=>5]);
|
||||
Util::setUserHistoryValue(['status'=>5], $identifier);
|
||||
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,12 +271,12 @@ class SalesController extends Controller
|
|||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$shopping_payment = ShoppingPayment::findOrFail($data['payment_id']);
|
||||
|
||||
PaymentTransaction::create([
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $shopping_payment->id,
|
||||
'request' => 'transaction',
|
||||
'txid' => 0,
|
||||
'userid' => 0,
|
||||
'status' => 'FNCMIV',
|
||||
'status' => $shopping_payment->clearingtype,
|
||||
'transmitted_data' => NULL,
|
||||
'txaction' => $data['txaction'],
|
||||
'mode' => $shopping_payment->mode,
|
||||
|
|
@ -288,14 +288,24 @@ class SalesController extends Controller
|
|||
$shopping_payment->txaction = $data['txaction'];
|
||||
$shopping_payment->save();
|
||||
|
||||
if($payt->status === 'vor' && $payt->txaction === 'paid'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, false);
|
||||
}
|
||||
$edata = [
|
||||
'mode' => $payt->mode,
|
||||
'txaction' => $payt->txaction,
|
||||
'send_link' => false,
|
||||
];
|
||||
//TODO can send MAIL
|
||||
//Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $edata);
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($data['back'])){
|
||||
|
||||
return redirect($data['back']);
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Http/Controllers/SettingController.php
Executable file
54
app/Http/Controllers/SettingController.php
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\IqImage;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductIngredient;
|
||||
use App\Models\Setting;
|
||||
use Request;
|
||||
|
||||
|
||||
class SettingController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'values' => Ingredient::all(),
|
||||
];
|
||||
return view('admin.settings.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['action'])){
|
||||
if(isset($data['settings'])){
|
||||
foreach ($data['settings'] as $key=>$value){
|
||||
Setting::setContentBySlug($key, $value['val'], $value['type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -76,16 +76,16 @@ class CheckoutController extends Controller
|
|||
Yard::instance('shopping')->setShippingCountryWithPrice($shopping_instance->country_id, $is_for);
|
||||
*/
|
||||
|
||||
if($this->getPayments('identifier') !== $identifier){
|
||||
$this->destroy();
|
||||
$this->putPayments('identifier', $identifier);
|
||||
}
|
||||
|
||||
$shopping_data = Yard::instance('shopping')->getYardExtra('shopping_data');
|
||||
$is_from = isset($shopping_data['is_from']) ? $shopping_data['is_from'] : 'shopping';
|
||||
$is_for = isset($shopping_data['is_for']) ? $shopping_data['is_for'] : false;
|
||||
$shopping_user = null;
|
||||
|
||||
if(\Session::has('new_session')){
|
||||
$this->destroy();
|
||||
\Session::forget('new_session');
|
||||
}
|
||||
|
||||
if(!$this->getPayments('shopping_user_id')){
|
||||
if($shopping_data && $is_from !== 'shopping'){
|
||||
|
|
@ -98,7 +98,6 @@ class CheckoutController extends Controller
|
|||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->is_for = $is_for;
|
||||
$shopping_user->is_from = $is_from;
|
||||
$shopping_user->homeparty_id = $homeparty_id;
|
||||
$shopping_user->mode = 'prev';
|
||||
}
|
||||
}else{
|
||||
|
|
@ -278,7 +277,7 @@ class CheckoutController extends Controller
|
|||
if($shopping_user->is_from === 'shopping'){
|
||||
CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
|
||||
}
|
||||
Util::setUserHistoryValue(['status'=>2, 'shopping_order_id'=>$shopping_order->id]);
|
||||
Util::setUserHistoryValue(['status'=>2, 'shopping_order_id'=>$shopping_order->id], $identifier);
|
||||
|
||||
//check credit Card
|
||||
if(Request::get('payment_method')){
|
||||
|
|
@ -302,48 +301,7 @@ class CheckoutController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function transactionStatus($status, $reference){
|
||||
|
||||
$shopping_order_id = $this->getPayments('shopping_order_id');
|
||||
|
||||
$ShoppingPayment = ShoppingPayment::where('shopping_order_id', $shopping_order_id)->where('reference', $reference)->first();
|
||||
if(!$ShoppingPayment){
|
||||
//TODO log this
|
||||
Util::setUserHistoryValue(['status'=>21]);
|
||||
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang konnte nicht abgeschlossen werden, die Zahlung wurde nicht gefunden: '.$reference);
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
}
|
||||
$ShoppingPayment->status = $status;
|
||||
$ShoppingPayment->save();
|
||||
|
||||
if($status === "success"){
|
||||
|
||||
Yard::instance('shopping')->destroy();
|
||||
$this->destroy();
|
||||
|
||||
$payt = $ShoppingPayment->payment_transactions->last();
|
||||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'order_reference' => $reference,
|
||||
'pay_trans' => $payt,
|
||||
];
|
||||
return view('web.templates.checkout-final', $data);
|
||||
}
|
||||
if($status === "cancel"){
|
||||
Util::setUserHistoryValue(['status'=>22]);
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
|
||||
}
|
||||
if($status === "error"){
|
||||
Util::setUserHistoryValue(['status'=>23]);
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function final($transactionId, $reference, $identifier) {
|
||||
|
||||
|
|
@ -355,7 +313,7 @@ class CheckoutController extends Controller
|
|||
$this->destroy();
|
||||
|
||||
if($payt->status === 'fnc' || $payt->status === 'vor'){
|
||||
$this->directPaymentStatus($payt);
|
||||
$this->directPaymentStatus($payt, $identifier);
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
|
@ -376,6 +334,48 @@ class CheckoutController extends Controller
|
|||
}
|
||||
}
|
||||
}*/
|
||||
public function transactionStatus($status, $reference){
|
||||
die("not defined");
|
||||
$shopping_order_id = $this->getPayments('shopping_order_id');
|
||||
|
||||
$ShoppingPayment = ShoppingPayment::where('shopping_order_id', $shopping_order_id)->where('reference', $reference)->first();
|
||||
if(!$ShoppingPayment){
|
||||
//TODO log this
|
||||
Util::setUserHistoryValue(['status'=>21]);
|
||||
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang konnte nicht abgeschlossen werden, die Zahlung wurde nicht gefunden: '.$reference);
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
}
|
||||
$ShoppingPayment->status = $status;
|
||||
$ShoppingPayment->save();
|
||||
|
||||
if($status === "success"){
|
||||
|
||||
Yard::instance('shopping')->destroy();
|
||||
$this->destroy();
|
||||
|
||||
$payt = $ShoppingPayment->payment_transactions->last();
|
||||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
'order_reference' => $reference,
|
||||
'pay_trans' => $payt,
|
||||
];
|
||||
return view('web.templates.checkout-final', $data);
|
||||
}
|
||||
if($status === "cancel"){
|
||||
Util::setUserHistoryValue(['status'=>22]);
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
|
||||
}
|
||||
if($status === "error"){
|
||||
Util::setUserHistoryValue(['status'=>23]);
|
||||
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function makeShoppingUser($data){
|
||||
|
||||
|
|
@ -403,7 +403,6 @@ class CheckoutController extends Controller
|
|||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
|
||||
$data = [
|
||||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
|
|
@ -506,18 +505,32 @@ class CheckoutController extends Controller
|
|||
$this->session->remove($this->instance);
|
||||
}
|
||||
|
||||
private function directPaymentStatus(PaymentTransaction $payt){
|
||||
private function directPaymentStatus(PaymentTransaction $payt, $identifier){
|
||||
|
||||
if(isset($payt->transmitted_data['param'])){
|
||||
$shopping_order = ShoppingOrder::find($payt->transmitted_data['param']);
|
||||
$shopping_payment = ShoppingPayment::where('reference', $payt->transmitted_data['reference'])->first();
|
||||
|
||||
$shopping_order->txaction = 'open';
|
||||
$shopping_order->save();
|
||||
$shopping_payment = ShoppingPayment::where('reference', $payt->transmitted_data['reference'])->first();
|
||||
|
||||
if($shopping_payment){
|
||||
$shopping_payment->txaction = 'open';
|
||||
if($payt->status === 'vor'){
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
|
||||
|
||||
}
|
||||
if($payt->status === 'fnc'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, false);
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
|
||||
|
||||
}
|
||||
$shopping_payment->save();
|
||||
}
|
||||
//$send_link = Payment::paymentStatusPaidAction($shopping_order, false);
|
||||
|
||||
//$payt->request = "approved";
|
||||
//$payt->save();
|
||||
$data = [
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class CustomerController extends Controller
|
|||
$step = 1;
|
||||
$shopping_user->same_as_billing = true;
|
||||
$shopping_user->faker_mail = true;
|
||||
$billing_email = time()."-faker@mivita.care";
|
||||
$billing_email = time()."-faker@gruene-seele.bio";
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ class OrderController extends Controller
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('superadmin');
|
||||
|
||||
$this->middleware('active.account');
|
||||
}
|
||||
|
||||
|
|
@ -159,14 +157,13 @@ class OrderController extends Controller
|
|||
'isView' => 'customer',
|
||||
'for' => $for,
|
||||
'delivery_id' => $delivery_id,
|
||||
'comp_products' => $this->getCompProducts($for),
|
||||
//'comp_products' => $this->getCompProducts($for),
|
||||
];
|
||||
return view('user.order.list', $data);
|
||||
}
|
||||
|
||||
public function payment($for, $id=null){
|
||||
$data = Request::all();
|
||||
|
||||
$user = User::find(Auth::user()->id);
|
||||
$rules = array(
|
||||
'shipping_salutation' => 'required',
|
||||
|
|
@ -180,10 +177,11 @@ class OrderController extends Controller
|
|||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
dd($validator);
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if(Yard::instance('shopping')->getNumComp() > 0){
|
||||
/* if(Yard::instance('shopping')->getNumComp() > 0){
|
||||
if(!isset($data['switchers-comp-product'])){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
|
||||
}else{
|
||||
|
|
@ -199,16 +197,20 @@ class OrderController extends Controller
|
|||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
do {
|
||||
*/
|
||||
/*do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );*/
|
||||
$identifier = Util::getToken();
|
||||
$data['is_from'] = 'user_order';
|
||||
$data['is_for'] = $for;
|
||||
$data['shopping_user_id'] = $id;
|
||||
unset($data['quantity']);
|
||||
unset($data['_token']);
|
||||
|
||||
ShoppingInstance::create([
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
|
||||
/*ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for buy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
|
|
@ -220,14 +222,13 @@ class OrderController extends Controller
|
|||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
|
||||
*/
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'abo_options'=>0]);
|
||||
//$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
|
||||
//return redirect()->secure($path);
|
||||
return redirect(route('user_checkout', [$identifier]));
|
||||
}
|
||||
|
||||
private function checkShoppingCountry($for, $id=null){
|
||||
|
|
@ -384,14 +385,13 @@ class OrderController extends Controller
|
|||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
public function performRequest(){
|
||||
|
||||
if(Request::ajax()) {
|
||||
$data = Request::all();
|
||||
|
||||
$data = Request::all();
|
||||
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot';
|
||||
$data['comp_products'] = $this->getCompProducts($is_for);
|
||||
// $data['comp_products'] = $this->getCompProducts($is_for);
|
||||
|
||||
if($data['action'] === 'updateCart' && isset($data['product_id'])){
|
||||
if($product = Product::find($data['product_id'])){
|
||||
|
|
@ -401,7 +401,7 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
//get the card item
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true), $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
|
||||
Yard::setTax($cartItem->rowId, $product->tax);
|
||||
|
||||
if(isset($data['qty']) && $data['qty'] > 0){
|
||||
|
|
@ -411,34 +411,31 @@ class OrderController extends Controller
|
|||
Yard::instance('shopping')->remove($cartItem->rowId);
|
||||
}
|
||||
//
|
||||
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
//$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
$html_comp = view("user.order.comp_product", $data)->render();
|
||||
//$html_comp = view("user.order.comp_product", $data)->render();
|
||||
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>'']);
|
||||
}
|
||||
}
|
||||
if($data['action'] === 'clearCart') {
|
||||
Yard::instance('shopping')->destroy();
|
||||
return response()->json(['response' => true, 'data'=>Yard::instance('shopping')->count(), 'html_card'=>'', 'html_comp'=>'']);
|
||||
|
||||
}
|
||||
|
||||
if($data['action'] === 'updateShippingCountry') {
|
||||
if(isset($data['shipping_country_id'])){
|
||||
if($shipping_country = ShippingCountry::find($data['shipping_country_id'])){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for);
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
//$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
}
|
||||
}
|
||||
$html_card = view("user.order.yard_view_form", $data)->render();
|
||||
$html_comp = view("user.order.comp_product", $data)->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
|
||||
|
||||
//$html_comp = view("user.order.comp_product", $data)->render();
|
||||
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>'']);
|
||||
}
|
||||
if($data['action'] === 'updateCompProduct'){
|
||||
/* if($data['action'] === 'updateCompProduct'){
|
||||
// $data['comp_product_id']
|
||||
// $data['comp_num']
|
||||
//count_comp_products
|
||||
|
|
@ -450,11 +447,12 @@ class OrderController extends Controller
|
|||
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
|
||||
|
||||
}
|
||||
*/
|
||||
return response()->json(['response' => false, 'data'=>$data]);
|
||||
}
|
||||
}
|
||||
|
||||
private function checkCompProduct($count_comp_products){
|
||||
/* private function checkCompProduct($count_comp_products){
|
||||
foreach (Yard::instance('shopping')->content() as $row) {
|
||||
//wenn gleich löschen, da neue Versandkosten
|
||||
if($row->options->comp > $count_comp_products) {
|
||||
|
|
@ -491,5 +489,5 @@ class OrderController extends Controller
|
|||
return Product::whereActive(true)->where('show_at', '=', 1)->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
@ -17,14 +17,11 @@ class TeamController extends Controller
|
|||
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;
|
||||
}
|
||||
$member_id = 'gs'.($user->id + config('main.add_number_id'));
|
||||
$register_link = route('register_user_member', [$member_id]);
|
||||
|
||||
$data = [
|
||||
'shop_register_link' => $shop_register_link
|
||||
'register_link' => $register_link
|
||||
];
|
||||
return view('user.team.members', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ class UserDataController extends Controller
|
|||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
|
||||
public function userEdit(){
|
||||
$user = Auth::user();
|
||||
|
||||
|
|
@ -35,16 +33,13 @@ class UserDataController extends Controller
|
|||
return view('user.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
|
||||
public function userEditStore(){
|
||||
|
||||
$user = Auth::user();
|
||||
/*if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}*/
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
|
|
@ -82,8 +77,10 @@ class UserDataController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
||||
*/
|
||||
public function userDataStore(){
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ namespace App\Http\Controllers\Web;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailContact;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\SysLog;
|
||||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use GuzzleHttp\Client;
|
||||
|
|
@ -32,23 +34,21 @@ class RegisterController extends Controller
|
|||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
/* public function member($member_id = false)
|
||||
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_id = (int) str_replace('gs', '', $member_id) - config('main.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);
|
||||
}*/
|
||||
return view('auth.register', $data);
|
||||
}
|
||||
|
||||
public function register(){
|
||||
|
||||
|
|
@ -78,13 +78,23 @@ class RegisterController extends Controller
|
|||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
if(isset($data['from_member_id'])){
|
||||
$user->m_sponsor = (int) str_replace('m', '', $data['from_member_id']) - config('main.add_number_id');
|
||||
$user->m_sponsor = (int) str_replace('gs', '', $data['from_member_id']) - config('main.add_number_id');
|
||||
}
|
||||
$user->save();
|
||||
|
||||
$user = User::find($user->id);
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('register-user', 'auth_register', 5)
|
||||
->setUserId($user->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setMessage('Error send register E-Mail: '.$e->getMessage())
|
||||
->save();
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'register', 'status'=>0]);
|
||||
|
||||
return redirect('/user_register/finish');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ class WizardController extends Controller
|
|||
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]);
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
//set onboarding products
|
||||
if(Request::get('products_on_board')){
|
||||
|
|
@ -461,7 +461,7 @@ class WizardController extends Controller
|
|||
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]);
|
||||
Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->price, $product->tax, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -488,7 +488,7 @@ class WizardController extends Controller
|
|||
|
||||
]);*/
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
//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]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue