testemich Promotion
This commit is contained in:
parent
38e7fd504a
commit
a0f4eda6ea
83 changed files with 1690 additions and 504 deletions
|
|
@ -68,7 +68,7 @@ class CronController extends Controller
|
|||
}
|
||||
//send new remider
|
||||
if ($user->confirmation_code_remider == 0) {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($user->confirmation_code, $user));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($user->confirmation_code, $user));
|
||||
$user->confirmation_code_to = $next;
|
||||
$user->confirmation_code_remider = 1;
|
||||
$user->save();
|
||||
|
|
@ -218,7 +218,7 @@ class CronController extends Controller
|
|||
]);
|
||||
try{
|
||||
if($status >= 34){
|
||||
Mail::to($user->email)->bcc(config('app.default_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}else{
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ class LeadController extends Controller
|
|||
|
||||
$data = Request::all();
|
||||
$show = Request::get('show');
|
||||
dd($data);
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
|
|
@ -203,7 +202,7 @@ class LeadController extends Controller
|
|||
//10 == start wizard form create Lead
|
||||
$user->wizard = 10;
|
||||
$user->save();
|
||||
Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailVerifyContact($confirmation_code, $user));
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_leads'));
|
||||
|
|
@ -260,7 +259,7 @@ class LeadController extends Controller
|
|||
|
||||
//mail with code to user?
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailAccountActive($user));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailAccountActive($user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('released', 'admin_lead', 5)
|
||||
|
|
@ -293,7 +292,7 @@ class LeadController extends Controller
|
|||
'confirmation_code' => $confirmation_code,
|
||||
];
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailCustomMessage($user, $data, \Auth::user(), true));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('released_incomplete', 'admin_lead', 5)
|
||||
|
|
@ -322,7 +321,7 @@ class LeadController extends Controller
|
|||
$user->save();
|
||||
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('new_mail_verified', 'admin_lead', 5)
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class PayController extends Controller
|
|||
|
||||
Util::setUserHistoryValue(['status'=>5], $identifier);
|
||||
switch ($payment_for) {
|
||||
case 4: //promotion
|
||||
case 7: //promotion
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $this->shopping_order->promotion_user_id, $payt->id, $this->reference, $identifier]));
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class PayPalController extends Controller
|
|||
"reference_id" => $shopping_payment->reference,
|
||||
"shopping_order_id" => $shopping_payment->shopping_order_id,
|
||||
"amount"=> [
|
||||
"currency_code"=> "USD",
|
||||
"currency_code"=> "EUR",
|
||||
"value"=> ($shopping_payment->amount / 100)
|
||||
],
|
||||
'description' => 'test'
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ class PaymentInvoiceController extends Controller
|
|||
->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
|
||||
return Payment::getShoppingOrderBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
|
||||
$ret = "";
|
||||
if(Invoice::isInvoice($ShoppingOrder)){
|
||||
|
|
@ -95,8 +98,9 @@ class PaymentInvoiceController extends Controller
|
|||
->orderColumn('invoice_number', 'invoice_number $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'shipping_order', 'txaction', 'invoice'])
|
||||
->rawColumns(['id', 'shipping_order', 'txaction', 'payment_for', 'invoice'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -81,17 +81,8 @@ class SalesController extends Controller
|
|||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'hp'){
|
||||
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
|
||||
}
|
||||
return '-';
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
|
|
@ -101,10 +92,11 @@ class SalesController extends Controller
|
|||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
|
||||
->rawColumns(['id', 'txaction', 'is_for', 'shipped'])
|
||||
->rawColumns(['id', 'txaction', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -217,17 +209,8 @@ class SalesController extends Controller
|
|||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'pr'){
|
||||
return '<span class="badge badge-pill badge-dark">Promotion</span>';
|
||||
}
|
||||
return '-';
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
|
|
@ -249,11 +232,11 @@ class SalesController extends Controller
|
|||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('is_for', 'is_for $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('member_id', 'member_id $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'is_for', 'shipped'])
|
||||
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -263,11 +246,13 @@ class SalesController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
if(isset($data['action'])){
|
||||
|
||||
if($data['action'] === 'store_shipped' && isset($data['shipped'])){
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$shopping_order->shipped = $data['shipped'];
|
||||
$shopping_order->save();
|
||||
|
||||
//handel Promotion Product and credit by storno
|
||||
Payment::handelUserPromotionOrder($shopping_order);
|
||||
if($shopping_order->getAPIShippedType() === 'sent' || $shopping_order->getAPIShippedType() === 'close'){
|
||||
if(!$shopping_order->shipped_at){
|
||||
$shopping_order->shipped_at = now();
|
||||
|
|
@ -304,11 +289,16 @@ class SalesController extends Controller
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === 'store_txaction' && isset($data['txaction']) && isset($data['payment_id'])){
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$shopping_payment = ShoppingPayment::findOrFail($data['payment_id']);
|
||||
|
||||
if($shopping_payment->txaction === $data['txaction']){
|
||||
return back();
|
||||
|
||||
}
|
||||
//shopping_order_margin Bestellung im partner Center
|
||||
if($shopping_order->shopping_order_margin && $shopping_order->shopping_order_margin->from_payment_credit > 0){
|
||||
$last_UserPayCredit = UserPayCredit::where('shopping_order_id', $shopping_order->id)->whereIn('status', [2, 4])->orderBy('id', 'DESC')->first();
|
||||
//Status Keine Zahlung, Guthaben zurückführen, wenn status 2 / deduction from payment
|
||||
|
|
@ -319,9 +309,7 @@ class SalesController extends Controller
|
|||
if($last_UserPayCredit && $last_UserPayCredit->status === 4 && ($data['txaction'] === 'open' || $data['txaction'] === 'paid')){
|
||||
Payment::handelUserPayCredits($shopping_order, 'deduction');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $shopping_payment->id,
|
||||
'request' => 'transaction',
|
||||
|
|
@ -332,7 +320,7 @@ class SalesController extends Controller
|
|||
'txaction' => $data['txaction'],
|
||||
'mode' => $shopping_payment->mode,
|
||||
]);
|
||||
|
||||
|
||||
$shopping_order->txaction = $data['txaction'];
|
||||
$shopping_order->paid = $payt->txaction === 'paid' ? true : false;
|
||||
$shopping_order->save();
|
||||
|
|
@ -342,6 +330,19 @@ class SalesController extends Controller
|
|||
if($payt->status === 'vor' && $payt->txaction === 'paid'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
}
|
||||
//handel credit loading by change when by $shopping_order_item->handl
|
||||
if($shopping_order->shopping_user->is_for === 'cr'){
|
||||
$last_UserPayCredit = UserPayCredit::where('shopping_order_id', $shopping_order->id)->whereIn('status', [7, 8])->orderBy('id', 'DESC')->first();
|
||||
//Status Keine Zahlung, Guthaben abziehen, wenn status 7 <- wurde aufgeladen
|
||||
if($data['txaction'] === 'non' && $last_UserPayCredit && $last_UserPayCredit->status === 7){
|
||||
Payment::handelUserPayChargingCredits($shopping_order, 'remove');
|
||||
}
|
||||
//Status Zahlung, voher gab es eine Storno, Guthaben wieder aufladen, wenn bezahlt wenn status 8
|
||||
if($last_UserPayCredit && $last_UserPayCredit->status === 8 && $data['txaction'] === 'paid'){
|
||||
Payment::handelUserPayChargingCredits($shopping_order, 'add');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$edata = [
|
||||
'mode' => $payt->mode,
|
||||
|
|
@ -362,7 +363,6 @@ class SalesController extends Controller
|
|||
|
||||
public function invoice(){
|
||||
$data = Request::all();
|
||||
//$data['id'] ShoppingOrder id
|
||||
if(!isset($data['id'])){
|
||||
abort(404);
|
||||
}
|
||||
|
|
@ -370,7 +370,11 @@ class SalesController extends Controller
|
|||
if($data['action'] === 'create_invoice'){
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$invoice_repo = new InvoiceRepository($shopping_order);
|
||||
$invoice_repo->create($data);
|
||||
if(\App\Services\Invoice::isInvoice($shopping_order)){
|
||||
$user_invoice = $invoice_repo->update($data);
|
||||
}else{
|
||||
$user_invoice = $invoice_repo->create($data);
|
||||
}
|
||||
return redirect(route('admin_sales_users_detail', [$shopping_order->id]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class SettingController extends Controller
|
|||
{
|
||||
|
||||
$data = [
|
||||
'values' => Ingredient::all(),
|
||||
'values' => [],
|
||||
];
|
||||
return view('admin.settings.index', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,9 @@ class AdminToolsController extends Controller
|
|||
public function index($action)
|
||||
{
|
||||
|
||||
dd($action);
|
||||
switch ($action) {
|
||||
case 'pay_credits':
|
||||
# code...
|
||||
dd($action);
|
||||
$value = $this->makeUserPayCredits();
|
||||
$data = [
|
||||
'values' => $value,
|
||||
|
|
@ -46,9 +45,28 @@ class AdminToolsController extends Controller
|
|||
];
|
||||
return view('sys.admin.index', $data);
|
||||
break;
|
||||
case 'value':
|
||||
# code...
|
||||
break;
|
||||
case 'export_vp':
|
||||
$values = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4)->get();
|
||||
$data = [
|
||||
'values' => $values,
|
||||
'text' => '',
|
||||
];
|
||||
return view('sys.admin.export_vp', $data);
|
||||
break;
|
||||
|
||||
case 'dbaction':
|
||||
$values = [];
|
||||
$data = [
|
||||
'values' => $values,
|
||||
//'text' => 'Add payment_for in shopping_order', //_dbOrderPaymentFor
|
||||
//'text' => 'Calculate TAX for shopping_order in tax_split array ',
|
||||
'text' => 'show in AdminToolsController dbaction',
|
||||
|
||||
|
||||
];
|
||||
return view('sys.admin.index', $data);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -57,23 +75,76 @@ class AdminToolsController extends Controller
|
|||
|
||||
public function store($action)
|
||||
{
|
||||
|
||||
|
||||
dd($action);
|
||||
|
||||
|
||||
$data = [];
|
||||
switch ($action) {
|
||||
case 'pay_credits':
|
||||
# code...
|
||||
dd($action);
|
||||
return view('sys.admin.index', $data);
|
||||
|
||||
break;
|
||||
case 'value':
|
||||
# code...
|
||||
case 'export_vp':
|
||||
return $this->export_vp();
|
||||
break;
|
||||
case 'dbaction':
|
||||
//return $this->_dbOrderPaymentFor();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function _dbOrderPaymentFor(){
|
||||
$c = 0;
|
||||
$ShoppingUsers = ShoppingUser::all();
|
||||
foreach($ShoppingUsers as $ShoppingUser){
|
||||
if($ShoppingUser->shopping_order){
|
||||
$ShoppingUser->shopping_order->payment_for = $ShoppingUser->getOrderPaymentFor();
|
||||
$ShoppingUser->shopping_order->save();
|
||||
$c ++;
|
||||
}
|
||||
}
|
||||
dd($c);
|
||||
}
|
||||
private function export_vp(){
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4)->get();
|
||||
$fileName = "GS-VP-export-".date("d-m-Y").".csv";
|
||||
$headers = array(
|
||||
"Content-type" => "text/csv",
|
||||
"Content-Disposition" => "attachment; filename=$fileName",
|
||||
"Pragma" => "no-cache",
|
||||
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
|
||||
"Expires" => "0"
|
||||
);
|
||||
|
||||
$columns = array('ID', 'Email', 'Firma', 'Anrede', 'Vorname', 'Nachname', 'Mitglied', 'Bis');
|
||||
$callback = function() use($query, $columns) {
|
||||
|
||||
$file = fopen('php://output', 'w');
|
||||
fputcsv($file, $columns);
|
||||
$row = [];
|
||||
|
||||
foreach ($query as $val) {
|
||||
$row['ID'] = $val->id;
|
||||
$row['Email'] = $val->email;
|
||||
$row['Firma'] = $val->account->company;
|
||||
$row['Anrede'] = $val->account->salutation == 'mr' ? 'Herr' : 'Frau' ;
|
||||
$row['Vorname'] = $val->account->first_name;
|
||||
$row['Nachname'] = $val->account->last_name;
|
||||
$row['Mitglied'] = $val->payment_account ? ($val->isActiveAccount() ? 'JA' : 'Abgelaufen') : "Nein";
|
||||
$row['Bis'] = $val->payment_account ? $val->getPaymentAccountDateFormat(false) : "-";
|
||||
fputcsv($file, $row);
|
||||
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
};
|
||||
|
||||
return response()->stream($callback, 200, $headers);
|
||||
|
||||
//dd("ok");
|
||||
|
||||
}
|
||||
|
||||
private function makeUserPayCredits()
|
||||
{
|
||||
//is the first of
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ class CheckoutController extends Controller
|
|||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'payment_for' => Util::getUserPaymentFor(),
|
||||
'payment_for' => $shopping_user->getOrderPaymentFor(),
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ''),
|
||||
'subtotal_full' => Yard::instance('shopping')->subtotal(2, '.', '', false),
|
||||
'discount' => $discount,
|
||||
|
|
|
|||
|
|
@ -76,26 +76,18 @@ class OrderController extends Controller
|
|||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'hp'){
|
||||
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
|
||||
}
|
||||
return '-';
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'txaction', 'is_for', 'shipped'])
|
||||
->rawColumns(['id', 'txaction', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +131,7 @@ class OrderController extends Controller
|
|||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
|
||||
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
|
|
@ -149,9 +141,15 @@ class OrderController extends Controller
|
|||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
|
||||
Yard::instance('shopping')->setShoppingUser($user, true);
|
||||
|
||||
if($for === 'cr'){
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
Yard::instance('shopping')->setShoppingUser($user, false);
|
||||
|
||||
}else{
|
||||
Yard::instance('shopping')->setShoppingUser($user, true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
|
|
@ -166,6 +164,7 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
public function payment($for, $id=null){
|
||||
|
||||
$data = Request::all();
|
||||
$user = User::find(Auth::user()->id);
|
||||
$rules = array(
|
||||
|
|
@ -182,7 +181,6 @@ class OrderController extends Controller
|
|||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if(Yard::instance('shopping')->getNumComp() > 0){
|
||||
if(!isset($data['switchers-comp-product'])){
|
||||
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
|
||||
|
|
@ -236,7 +234,7 @@ class OrderController extends Controller
|
|||
private function checkShoppingCountry($for, $id=null){
|
||||
|
||||
$country_id = null;
|
||||
if($for === 'me'){
|
||||
if($for === 'me' || $for === 'mp' || $for === 'cr'){
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if($user->same_as_billing){
|
||||
$country_id = $user->account->country_id;
|
||||
|
|
@ -279,11 +277,22 @@ class OrderController extends Controller
|
|||
public function datatable(){
|
||||
|
||||
$not_show_pids = ProductBuy::getNotShowProductIDs(Auth::user()->id);
|
||||
if(Request::get('shipping_is_for') === 'me'){
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
}else{
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '1');
|
||||
|
||||
switch (Request::get('shipping_is_for')) {
|
||||
case 'me':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
break;
|
||||
case 'mp':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
break;
|
||||
case 'cr':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '6');
|
||||
break;
|
||||
case 'ot':
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '1');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach($not_show_pids as $not_show_pid){
|
||||
$query->where('id', '!=', $not_show_pid);
|
||||
|
|
|
|||
|
|
@ -62,8 +62,16 @@ class PromotionController extends Controller
|
|||
if(isset($data['action']) && $data['action'] === 'save-user-promotion'){
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|'.'unique:promotion_users,url,'.$id.',id'.'|min:4|max:20|full_word_check',
|
||||
);
|
||||
Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
$profanity = \App\Models\Setting::getContentBySlug('promotion_user_url_profanity');
|
||||
$profanity = array_map('trim', explode(',', $profanity));
|
||||
if(in_array($value, $profanity)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect(route('user_promotion_detail', [$id]))->withErrors($validator)->withInput(Request::all());
|
||||
|
|
@ -95,16 +103,21 @@ class PromotionController extends Controller
|
|||
$data = Request::all();
|
||||
if(Request::ajax()) {
|
||||
if(isset($data['action']) && $data['action'] === 'validate_url'){
|
||||
$unique = 'unique:promotion_users,url';
|
||||
if(isset($data['puid'])){
|
||||
$unique .= ','.$data['puid'].',id';
|
||||
}
|
||||
$rules = array(
|
||||
//'user_promotion_url' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|full_word_check',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
|
||||
'user_promotion_url' => ' required|alpha_dash|profanity|'.$unique.'|min:4|max:20|full_word_check',
|
||||
);
|
||||
/*Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
if(in_array($value, config('profanity.full_word_check'))){
|
||||
Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
$profanity = \App\Models\Setting::getContentBySlug('promotion_user_url_profanity');
|
||||
$profanity = array_map('trim', explode(',', $profanity));
|
||||
if(in_array($value, $profanity)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});*/
|
||||
});
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
|
|
|||
|
|
@ -61,21 +61,13 @@ class SalesController extends Controller
|
|||
->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('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'pr'){
|
||||
return '<span class="badge badge-pill badge-dark">Promotion</span>';
|
||||
}
|
||||
return '-';
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->rawColumns(['id', 'is_for', 'txaction', 'user_shop_id'])
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->rawColumns(['id', 'payment_for', 'txaction', 'user_shop_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class UserUpdateEmailController extends Controller
|
|||
public function sendActivationMail($user, array $data)
|
||||
{
|
||||
$token = $this->createActivation($user, $data);
|
||||
Mail::to($data['email'])->send(new MailActivateUser($token, $user));
|
||||
Mail::to($data['email'])->bcc(config('app.info_mail'))->send(new MailActivateUser($token, $user));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,20 @@ class PromotionController extends Controller
|
|||
public function serve($path = null)
|
||||
{
|
||||
if(!isset($path)){
|
||||
abort(402);
|
||||
$path = 'grueneseele';
|
||||
//abort(402);
|
||||
|
||||
}
|
||||
|
||||
if($path === 'impressum'){
|
||||
return view('web.promotion.impressum');
|
||||
}
|
||||
if($path === 'datenschutzerklaerung'){
|
||||
return view('web.promotion.datenschutzerklaerung');
|
||||
}
|
||||
if($path === 'widerrufsbelehrung'){
|
||||
return view('web.promotion.widerrufsbelehrung');
|
||||
}
|
||||
|
||||
//search for promo
|
||||
$PromotionUser = PromotionUser::where('url', trim($path))->whereNull('user_deleted_at')->first();
|
||||
if(!$PromotionUser){
|
||||
|
|
@ -137,14 +148,9 @@ class PromotionController extends Controller
|
|||
|
||||
UserHistory::create(['user_id' => $PromotionUser->user_id, 'action'=>'web_promotion_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier]);
|
||||
$checkRepo = new CheckoutRepository();
|
||||
$checkRepo->setPromotion(4, $PromotionUser);
|
||||
$checkRepo->setPromotion(7, $PromotionUser);
|
||||
$checkRepo->init($identifier, $data);
|
||||
return $checkRepo->makePayment();
|
||||
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
//return redirect()->secure($path);
|
||||
// return redirect(route('user_checkout', [$identifier]));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,18 +174,23 @@ class PromotionController extends Controller
|
|||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
$payt->txaction = "open";
|
||||
$shopping_order->save();
|
||||
|
||||
}
|
||||
if($payt->status === 'pp'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
}
|
||||
if($payt->status === 'fnc'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
$payt->txaction = "open";
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
|
||||
}
|
||||
if($payt->status === 'non'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
|
|
@ -248,7 +259,7 @@ class PromotionController extends Controller
|
|||
$invoice = view("web.promotion._invoice_details")->render();
|
||||
}
|
||||
$checkout = view("web.promotion._checkout")->render();
|
||||
$data['shipping_price_formated'] = Yard::instance('shopping')->shipping();
|
||||
$data['shipping_price_formated'] = PromotionCart::getCurrentShippingPrice();
|
||||
|
||||
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class RegisterController extends Controller
|
|||
$user = User::find($user->id);
|
||||
|
||||
try {
|
||||
Mail::to($user->email)->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('register-user', 'auth_register', 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue