diff --git a/.env b/.env
index d15f579..c6b5f9a 100644
--- a/.env
+++ b/.env
@@ -53,13 +53,13 @@ MAIL_USERNAME=web28p3
MAIL_PASSWORD=WeE2bmI9GjB7pDgi
MAIL_ENCRYPTION=""
MAIL_FROM_ADDRESS=partner@gruene-seele.bio
-MAIL_FROM_NAME="Partner GRÜNE SEELE Naturkosmetik"
+MAIL_FROM_NAME="GRÜNE SEELE Naturkosmetik"
PAYPAL_MODE=sandbox
-PAYPAL_SANDBOX_CLIENT_ID=AYePlmttXXyoUJTgECTiyXht7LKCOIe4tky4q943NQQRsqyFhLYLHUzYbyhXvKJAXp--lrO040iZWtRB
-PAYPAL_SANDBOX_CLIENT_SECRET=EE9-80_RVcl6m7BRYPrVCrZFeQWhSAIClCLULOiC07DIxf_Sb4pyBdnCgewv_ULrGDwEcSIUeeBDiUQI
-PAYPAL_LIVE_CLIENT_ID=AWz915k8LX6k4auJFVsP4Rwa5koRP718pEbnDAcXnaN--ox1ZsoPanBIE32EXdUscF292-XZNSTH8_t-
-PAYPAL_LIVE_CLIENT_SECRET=EMWCXquC3j5f7rmBu4dkkSN4I3V0OLbGss2seXeCc0TfpR9cMbv7GGm3b0i1xgMTFlJNIsAWtB-FjRyW
+PAYPAL_SANDBOX_CLIENT_ID=AWMeW59cMOHaMWfv44kIMnzaR81Qo4yNVzEC5LyWl7x5RjkJZOJmvbvljqWPNEw7GihF3FLRL_tEJPHo
+PAYPAL_SANDBOX_CLIENT_SECRET=EFOuvQJpx3lM2HjLjPURgcxKuGLtKxNHKZqx65uQpQ8WNLDvijHhb79X5oE22LKIwW5V0GdX09jI24bF
+PAYPAL_LIVE_CLIENT_ID=ATBZUigDw1yuakQj9X7semskqBrBxSV3bOjp3AtHV5pCSc3tOIm1m2s3toUfGW9lcxQJ5_fSS37FVbki
+PAYPAL_LIVE_CLIENT_SECRET=ECCH1CPCiHLzEMbl3rMSo1PVSqn2iqu59t-ZUXSx4p1J_tTklpl9QGkBN77s9DfCA1dQ6u7VfBBfPApn
AWS_ACCESS_KEY_ID=
diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php
index c0ca163..c7f2d78 100644
--- a/app/Http/Controllers/CronController.php
+++ b/app/Http/Controllers/CronController.php
@@ -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));
}
diff --git a/app/Http/Controllers/LeadController.php b/app/Http/Controllers/LeadController.php
index b3a24e7..c4101b0 100755
--- a/app/Http/Controllers/LeadController.php
+++ b/app/Http/Controllers/LeadController.php
@@ -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)
diff --git a/app/Http/Controllers/Pay/PayController.php b/app/Http/Controllers/Pay/PayController.php
index 2c613d2..5151e04 100644
--- a/app/Http/Controllers/Pay/PayController.php
+++ b/app/Http/Controllers/Pay/PayController.php
@@ -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;
diff --git a/app/Http/Controllers/Pay/PayPalController.php b/app/Http/Controllers/Pay/PayPalController.php
index 2d26568..7e4e9b7 100644
--- a/app/Http/Controllers/Pay/PayPalController.php
+++ b/app/Http/Controllers/Pay/PayPalController.php
@@ -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'
diff --git a/app/Http/Controllers/PaymentInvoiceController.php b/app/Http/Controllers/PaymentInvoiceController.php
index 4e5c26e..ee03755 100644
--- a/app/Http/Controllers/PaymentInvoiceController.php
+++ b/app/Http/Controllers/PaymentInvoiceController.php
@@ -80,6 +80,9 @@ class PaymentInvoiceController extends Controller
->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
+ ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
+ return ''.$ShoppingOrder->getPaymentForType().' ';
+ })
->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);
}
}
\ No newline at end of file
diff --git a/app/Http/Controllers/SalesController.php b/app/Http/Controllers/SalesController.php
index 2e1d9cf..d32b1f2 100755
--- a/app/Http/Controllers/SalesController.php
+++ b/app/Http/Controllers/SalesController.php
@@ -81,17 +81,8 @@ class SalesController extends Controller
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return ''.$ShoppingOrder->getShippedType().' ';
})
- ->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
- if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Vertriebspartnerbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'ot'){
- return 'Kundenbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'hp'){
- return 'Homepartybestellung ';
- }
- return '-';
+ ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
+ return ''.$ShoppingOrder->getPaymentForType().' ';
})
->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 ''.$ShoppingOrder->getShippedType().' ';
})
- ->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
- if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Vertriebspartnerbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'ot'){
- return 'Kundenbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'pr'){
- return 'Promotion ';
- }
- return '-';
+ ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
+ return ''.$ShoppingOrder->getPaymentForType().' ';
})
->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]));
}
}
diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php
index 6495ec6..361fa83 100755
--- a/app/Http/Controllers/SettingController.php
+++ b/app/Http/Controllers/SettingController.php
@@ -24,7 +24,7 @@ class SettingController extends Controller
{
$data = [
- 'values' => Ingredient::all(),
+ 'values' => [],
];
return view('admin.settings.index', $data);
}
diff --git a/app/Http/Controllers/SyS/AdminToolsController.php b/app/Http/Controllers/SyS/AdminToolsController.php
index 1bea719..ed38748 100755
--- a/app/Http/Controllers/SyS/AdminToolsController.php
+++ b/app/Http/Controllers/SyS/AdminToolsController.php
@@ -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
diff --git a/app/Http/Controllers/User/CheckoutController.php b/app/Http/Controllers/User/CheckoutController.php
index f294a0e..8d1d119 100755
--- a/app/Http/Controllers/User/CheckoutController.php
+++ b/app/Http/Controllers/User/CheckoutController.php
@@ -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,
diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php
index d06772e..0c82029 100755
--- a/app/Http/Controllers/User/OrderController.php
+++ b/app/Http/Controllers/User/OrderController.php
@@ -76,26 +76,18 @@ class OrderController extends Controller
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return ''.$ShoppingOrder->getShippedType().' ';
})
- ->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
- if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Vertriebspartnerbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'ot'){
- return 'Kundenbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'hp'){
- return 'Homepartybestellung ';
- }
- return '-';
+ ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
+ return ''.$ShoppingOrder->getPaymentForType().' ';
})
->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);
diff --git a/app/Http/Controllers/User/PromotionController.php b/app/Http/Controllers/User/PromotionController.php
index ce267a5..3d9bce4 100644
--- a/app/Http/Controllers/User/PromotionController.php
+++ b/app/Http/Controllers/User/PromotionController.php
@@ -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()) {
diff --git a/app/Http/Controllers/User/SalesController.php b/app/Http/Controllers/User/SalesController.php
index 405c452..2413e8f 100755
--- a/app/Http/Controllers/User/SalesController.php
+++ b/app/Http/Controllers/User/SalesController.php
@@ -61,21 +61,13 @@ class SalesController extends Controller
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->user_shop ? ''.$ShoppingOrder->user_shop->getSubdomain(false).'' : '';
})
- ->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
- if($ShoppingOrder->shopping_user->is_for === 'me'){
- return 'Vertriebspartnerbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'ot'){
- return 'Kundenbestellung ';
- }
- if($ShoppingOrder->shopping_user->is_for === 'pr'){
- return 'Promotion ';
- }
- return '-';
+ ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
+ return ''.$ShoppingOrder->getPaymentForType().' ';
})
->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);
}
diff --git a/app/Http/Controllers/UserUpdateEmailController.php b/app/Http/Controllers/UserUpdateEmailController.php
index 1a0996e..b10221e 100755
--- a/app/Http/Controllers/UserUpdateEmailController.php
+++ b/app/Http/Controllers/UserUpdateEmailController.php
@@ -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));
}
diff --git a/app/Http/Controllers/Web/PromotionController.php b/app/Http/Controllers/Web/PromotionController.php
index 887e5ef..36efea9 100644
--- a/app/Http/Controllers/Web/PromotionController.php
+++ b/app/Http/Controllers/Web/PromotionController.php
@@ -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]);
}
diff --git a/app/Http/Controllers/Web/RegisterController.php b/app/Http/Controllers/Web/RegisterController.php
index 0e0ecb1..cf950b4 100755
--- a/app/Http/Controllers/Web/RegisterController.php
+++ b/app/Http/Controllers/Web/RegisterController.php
@@ -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)
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 35e9a88..2afc8b2 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -136,7 +136,7 @@ class Category extends Model
public function getShowOnTypes(){
$ret = [];
- if(is_array($this->show_on)){
+ if($this->show_on && is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
}
diff --git a/app/Models/PaymentMethod.php b/app/Models/PaymentMethod.php
index ce85ec7..eacaef1 100644
--- a/app/Models/PaymentMethod.php
+++ b/app/Models/PaymentMethod.php
@@ -73,7 +73,7 @@ class PaymentMethod extends Model
public function getShowOnTypes(){
$ret = [];
- if($this->show_on){
+ if($this->show_on && is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset(Type::$payShowONs[$show]) ? Type::$payShowONs[$show] : '-';
}
diff --git a/app/Models/Product.php b/app/Models/Product.php
index f8e5148..de08b3d 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -224,6 +224,7 @@ class Product extends Model
public $actions = [
0 => 'payment_for_account',
+ 1 => 'charging_credits',
// 1 => 'payment_for_shop',
// 2 => 'payment_for_shop_upgrade',
// 4 => 'payment_for_lead_upgrade',
@@ -425,8 +426,10 @@ class Product extends Model
public function getShowOnTypes(){
$ret = [];
- foreach($this->show_on as $show){
- $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
+ if($this->show_on && is_array($this->show_on)){
+ foreach($this->show_on as $show){
+ $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
+ }
}
return $ret;
}
diff --git a/app/Models/ProductCategory.php b/app/Models/ProductCategory.php
index e86571b..620e0c2 100644
--- a/app/Models/ProductCategory.php
+++ b/app/Models/ProductCategory.php
@@ -49,8 +49,10 @@ class ProductCategory extends Model
public function getShowOnTypes(){
$ret = [];
- foreach($this->show_on as $show){
- $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
+ if($this->show_on && is_array($this->show_on)){
+ foreach($this->show_on as $show){
+ $ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
+ }
}
return $ret;
}
diff --git a/app/Models/PromotionAdminProduct.php b/app/Models/PromotionAdminProduct.php
index d8f4108..dc0d4cf 100644
--- a/app/Models/PromotionAdminProduct.php
+++ b/app/Models/PromotionAdminProduct.php
@@ -102,7 +102,7 @@ class PromotionAdminProduct extends Model
public function setPriceAttribute( $value ) {
- $this->attributes['price'] = $value ? Util::reFormatNumber($value) : null;
+ $this->attributes['price'] = $value !== null ? Util::reFormatNumber($value) : null;
}
public function getFormattedPrice()
@@ -112,7 +112,7 @@ class PromotionAdminProduct extends Model
public function getRealPrice()
{
- if($this->own_price && $this->price){
+ if($this->own_price && $this->price !== null){
return $this->price;
}
if($this->product && $this->product->price){
diff --git a/app/Models/PromotionUser.php b/app/Models/PromotionUser.php
index 13e24f0..47b81f2 100644
--- a/app/Models/PromotionUser.php
+++ b/app/Models/PromotionUser.php
@@ -121,7 +121,18 @@ class PromotionUser extends Model
return $this->hasMany(PromotionUserProduct::class)->where('active', 1);
}
-
+ public function promotion_user_orders()
+ {
+ return $this->hasMany(PromotionUserOrder::class);
+ }
+
+ public function getPromotionUserOrders($shopping_order_id)
+ {
+ return PromotionUserOrder::where('promotion_user_id', $this->id)->where('shopping_order_id', $shopping_order_id)->get();
+ }
+
+
+
public function getUrlPreview()
{
return $this->url ? config('app.promo_url')."/".$this->url : "";
@@ -182,12 +193,15 @@ class PromotionUser extends Model
public function checkPaymentCredit()
{
if($this->promotion_user_products_active->count() > 0 && $this->getCountOpenItems() > 0){
+ $prices = $this->calculateCart();
+ if(isset($prices['price']) && $prices['price'] == 0){
+ return "okay";
+ }
$payment_credit = $this->user->payment_credit;
if($payment_credit <= 0){
return "empty";
}
- $prices = $this->calculateCart();
if(isset($prices['price']) && $prices['price'] > 0){
if($payment_credit >= $prices['price']){
return "okay";
@@ -211,8 +225,12 @@ class PromotionUser extends Model
return false;
}
+
public static function preCheckPaymentCredit($values, $user){
if($values['count_items'] > 0 && $values['sum_items'] > 0){
+ if(isset($values['price']) && $values['price'] == 0){
+ return "okay";
+ }
$payment_credit = $user->payment_credit;
if($payment_credit <= 0){
return "empty";
@@ -227,7 +245,6 @@ class PromotionUser extends Model
return false;
}
-
public static function preCalculateCart($value, $by = ''){
$price = 0;
$price_net = 0;
diff --git a/app/Models/PromotionUserOrder.php b/app/Models/PromotionUserOrder.php
index 3ac4fd8..ca6c354 100644
--- a/app/Models/PromotionUserOrder.php
+++ b/app/Models/PromotionUserOrder.php
@@ -71,7 +71,8 @@ class PromotionUserOrder extends Model
'price' => 'float',
'price_net' => 'float',
'tax_rate' => 'float',
- 'status' => 'int'
+ 'status' => 'int',
+ 'pick_up' => 'bool',
];
protected $fillable = [
@@ -86,9 +87,15 @@ class PromotionUserOrder extends Model
'price',
'price_net',
'tax_rate',
- 'status'
+ 'status',
+ 'pick_up'
];
+ public static $statusTypes = [
+ 0 => 'bestellt',
+ 10 => 'storniert'
+ ];
+
public function product()
{
return $this->belongsTo(Product::class);
@@ -123,4 +130,29 @@ class PromotionUserOrder extends Model
{
return $this->belongsTo(ShoppingUser::class);
}
+
+ public function getStatusType(){
+ return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
+ }
+
+ public function setStatusTxAction($txaction){
+
+ switch ($txaction) {
+ case 'none':
+ $this->status = 10;
+ break;
+ case 'open':
+ $this->status = 0;
+ break;
+ case 'paid':
+ $this->status = 3;
+ break;
+ }
+ $this->save();
+ }
+
+ public function setStatusShipped($shipped){
+ $this->status = $shipped === 'cancel' ? 10 : 0;
+ $this->save();
+ }
}
diff --git a/app/Models/PromotionUserProduct.php b/app/Models/PromotionUserProduct.php
index 5f3d82c..2f2a40c 100644
--- a/app/Models/PromotionUserProduct.php
+++ b/app/Models/PromotionUserProduct.php
@@ -96,4 +96,5 @@ class PromotionUserProduct extends Model
}
return false;
}
+
}
diff --git a/app/Models/ShoppingOrder.php b/app/Models/ShoppingOrder.php
index 76116be..5d2730f 100644
--- a/app/Models/ShoppingOrder.php
+++ b/app/Models/ShoppingOrder.php
@@ -157,23 +157,49 @@ class ShoppingOrder extends Model
1 => 'in Bearbeitung',
2 => 'versendet',
3 => 'abgeschlossen',
+ 4 => 'Abholung',
10 => 'storniert'
];
public static $paymentForTypes = [
0 => '',
- 1 => 'wizzard',
- 2 => 'user_order me',
- 3 => 'user_order ot',
- 4 => 'Promotion',
- 10 => ''
+ 1 => 'Registrierung',
+ 2 => 'Mitgliedschaft',
+ 3 => 'Guthabenaufladung', //guthaben
+ 4 => 'VP.Bestellung Abholung',
+ 5 => 'VP.Bestellung Lieferung',
+ 6 => 'VP.Kundenbestellung',
+ 7 => 'Promotion',
+ 8 => 'Shop',
+ 9 => '-',
+ 10 => 'extern',
+ 11 => ''
];
+ public static $paymentForColors = [
+
+ 0 => 'default',
+ 1 => 'warning',
+ 2 => 'warning',
+ 3 => 'secondary',
+ 4 => 'secondary',
+ 5 => 'secondary',
+ 6 => 'info',
+ 7 => 'dark',
+ 8 => 'info',
+ 9 => 'default',
+ 10 => 'info',
+ 11 => 'default'
+
+ ];
+
+
public static $apiShippedTypes = [
0 => 'open', //(Fullfilment durch Händler)',
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
2 => 'sent', //(Fullfilment durch MIVITA: Versand erfolgt)'
3 => 'close', //(Fullfilment durch MIVITA: Versand erfolgt)',
+ 4 => 'pick_up', //(Fullfilment durch MIVITA: Versand erfolgt)',
10 => 'cancel'
];
@@ -182,6 +208,7 @@ class ShoppingOrder extends Model
1 => 'info',
2 => 'success',
3 => 'secondary',
+ 4 => 'success',
10 => 'danger',
];
@@ -272,6 +299,13 @@ class ShoppingOrder extends Model
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
}
+ public function getPaymentForType(){
+ return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : "";
+ }
+ public function getPaymentForColor(){
+ return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
+ }
+
public function getFormattedTotal()
{
return formatNumber($this->attributes['total']);
@@ -319,8 +353,6 @@ class ShoppingOrder extends Model
{
return formatNumber($this->attributes['payment_credit']);
}
-
-
public function getFormattedTotalShipping()
{
return formatNumber($this->attributes['total_shipping']);
@@ -333,10 +365,14 @@ class ShoppingOrder extends Model
$count += $shopping_order_item->qty;
}
}
-
return $count;
}
+ public function isPickUp(){
+ return $this->shipping_option === 'pick_up' ? true : false;
+ }
-
+ public function isTax(){
+ return $this->tax > 0 ? true : false;
+ }
}
diff --git a/app/Models/ShoppingOrderItem.php b/app/Models/ShoppingOrderItem.php
index ca7fd7f..c92a45c 100644
--- a/app/Models/ShoppingOrderItem.php
+++ b/app/Models/ShoppingOrderItem.php
@@ -56,6 +56,18 @@ class ShoppingOrderItem extends Model
use SoftDeletes;
protected $dates = ['deleted_at'];
+ protected $casts = [
+ 'shopping_order_id' => 'int',
+ 'product_id' => 'int',
+ 'comp' => 'int',
+ 'free_product_id' => 'int',
+ 'qty' => 'int',
+ 'price' => 'float',
+ 'price_net' => 'float',
+ 'tax_rate' => 'float',
+ 'handle' => 'bool',
+ ];
+
protected $fillable = [
'shopping_order_id',
'row_id',
@@ -67,6 +79,7 @@ class ShoppingOrderItem extends Model
'price_net',
'tax_rate',
'slug',
+ 'handle',
];
diff --git a/app/Models/ShoppingUser.php b/app/Models/ShoppingUser.php
index eed57ca..1f9be98 100644
--- a/app/Models/ShoppingUser.php
+++ b/app/Models/ShoppingUser.php
@@ -251,4 +251,33 @@ class ShoppingUser extends Model
}
return "free";
}
+
+ public function getOrderPaymentFor() {
+
+ switch($this->is_from){
+ case 'wizard':
+ return 1;
+ case 'membership':
+ return 2;
+ case 'user_order':
+ if($this->is_for === 'cr'){
+ return 3;
+ }
+ if($this->is_for === 'mp'){
+ return 4;
+ }
+ if($this->is_for === 'me'){
+ return 5;
+ }
+ if($this->is_for === 'ot'){
+ return 6;
+ }
+ return 0;
+ case 'shopping':
+ return $this->is_for === 'pr' ? 7 : 8; //7 Promotion
+ case 'extern':
+ return 10;
+ }
+ return 0;
+ }
}
\ No newline at end of file
diff --git a/app/Models/UserPayCredit.php b/app/Models/UserPayCredit.php
index 7ba72c2..f503d10 100644
--- a/app/Models/UserPayCredit.php
+++ b/app/Models/UserPayCredit.php
@@ -50,7 +50,10 @@ class UserPayCredit extends Model
4 => 'return from order',
5 => 'deduction from promotion',
6 => 'return from promotion',
+ 7 => 'add credits from charging',
+ 8 => 'remove credits from charging',
];
+
protected $table = 'user_pay_credits';
protected $casts = [
diff --git a/app/Repositories/CheckoutRepository.php b/app/Repositories/CheckoutRepository.php
index 2273a37..a8909c3 100644
--- a/app/Repositories/CheckoutRepository.php
+++ b/app/Repositories/CheckoutRepository.php
@@ -137,6 +137,7 @@ class CheckoutRepository {
'weight' => Yard::instance('shopping')->weight(),
'txaction' => 'prev',
'shipping_option' => Yard::instance('shopping')->getShippingOption(),
+ 'shipped' => Yard::instance('shopping')->getShippingOption() === 'pick_up' ? 4 : 0,
'mode' => Util::getUserShoppingMode(),
];
diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php
index 57e01b5..0176a7e 100644
--- a/app/Repositories/InvoiceRepository.php
+++ b/app/Repositories/InvoiceRepository.php
@@ -10,6 +10,11 @@ use App\Services\MyPDFMerger;
class InvoiceRepository extends BaseRepository {
+ private $invoice_date;
+ private $invoice_number;
+ private $filename;
+ private $dir;
+
public function __construct(ShoppingOrder $model)
{
$this->model = $model;
@@ -18,53 +23,81 @@ class InvoiceRepository extends BaseRepository {
public function create($request = [])
{
//need invoice $data
- $invoice_number = isset($request['invoice_number']) ? $request['invoice_number'] : Invoice::getInvoiceNumber();
- $invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $this->model->created_at->format("d.m.Y");
-
+ $number = Invoice::getInvoiceNumber();
+ $this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $this->model->created_at->format("d.m.Y");
$invoice_send_mail = isset($request['invoice_send_mail']) ? true: false;
- $invoice_number = Invoice::createInvoiceNumber($invoice_number, $invoice_date);
+ $this->invoice_number = Invoice::createInvoiceNumber($number, $this->invoice_date);
+ $this->dir = Invoice::getInvoiceStorageDir($this->invoice_date);
+ $this->filename = Invoice::makeInvoiceFilename($this->invoice_number);
+ $this->makePDF();
+
+ $data_file = [
+ 'filename' => $this->filename,
+ 'dir' => $this->dir,
+ 'disk' => 'public',
+ 'invoice_number' => $this->invoice_number,
+ 'invoice_date' => $this->invoice_date,
+ ];
+ $this->model->invoice = $data_file;
+ $this->model->invoice_number = $this->invoice_number;
+ $this->model->save();
+ Invoice::makeNextInvoiceNumber();
+
+ if($invoice_send_mail){
+ Invoice::sendInvoiceMail($this->model);
+ }
+ return true;
+ }
+
+ public function update($request = []){
+ if(isset($this->model->invoice['filename'])){
+ $this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : Invoice::getDate($this->model);
+ $invoice_send_mail = isset($request['invoice_send_mail']) ? true: false;
+ $this->invoice_number = Invoice::getNumber($this->model);
+ $this->dir = Invoice::getDir($this->model);
+ $this->filename = Invoice::getFilename($this->model);
+
+ $this->makePDF();
+
+ $data_file = [
+ 'filename' => $this->filename,
+ 'dir' => $this->dir,
+ 'disk' => 'public',
+ 'invoice_number' => $this->invoice_number,
+ 'invoice_date' => $this->invoice_date,
+ ];
+ $this->model->invoice = $data_file;
+ $this->model->invoice_number = $this->invoice_number;
+ $this->model->save();
+
+ if($invoice_send_mail){
+ Invoice::sendInvoiceMail($this->model);
+ }
+ return true;
+ }
+ return null;
+ }
+
+ private function makePDF(){
$data = [
'shopping_order' => $this->model,
- 'invoice_date' => $invoice_date,
- 'invoice_number' => $invoice_number,
+ 'invoice_date' => $this->invoice_date,
+ 'invoice_number' => $this->invoice_number,
];
$pdf = PDF::loadView('pdf.invoice', $data);
$pdf->setPaper('A4', 'portrait');
- $dir = Invoice::getInvoiceStorageDir($invoice_date);
-
- if(!Storage::disk('public')->exists( $dir )){
- Storage::disk('public')->makeDirectory($dir); //creates directory
+ if(!Storage::disk('public')->exists( $this->dir )){
+ Storage::disk('public')->makeDirectory($this->dir); //creates directory
}
$path = Storage::disk('public')->getAdapter()->getPathPrefix();
- $filename = Invoice::makeInvoiceFilename($invoice_number);
- $pdf->save($path.$dir.$filename);
+ $pdf->save($path.$this->dir.$this->filename);
$pdfMerger = new MyPDFMerger();
- $pdfMerger->addPDF($path.$dir.$filename);
- $file = $pdfMerger->myMerge('string', $filename, 'template_invoice_de');
- Storage::disk('public')->put($dir.$filename, $file);
-
- $data_file = [
- 'filename' => $filename,
- 'dir' => $dir,
- 'disk' => 'public',
- 'invoice_number' => $invoice_number,
- 'invoice_date' => $invoice_date,
- ];
- $this->model->invoice = $data_file;
- $this->model->invoice_number = $invoice_number;
- $this->model->save();
-
- if($invoice_send_mail){
- Invoice::sendInvoiceMail($this->model);
- }
-
- Invoice::makeNextInvoiceNumber();
- return true;
- //return $pdf->stream('invoice.pdf');
- //return $this->output($path.$dir, $filename);
+ $pdfMerger->addPDF($path.$this->dir.$this->filename);
+ $file = $pdfMerger->myMerge('string', $this->filename, 'template_invoice_de');
+ Storage::disk('public')->put($this->dir.$this->filename, $file);
}
}
\ No newline at end of file
diff --git a/app/Services/Invoice.php b/app/Services/Invoice.php
index 26fd61f..4d715a8 100644
--- a/app/Services/Invoice.php
+++ b/app/Services/Invoice.php
@@ -39,16 +39,24 @@ class Invoice
return isset($shopping_order->invoice['filename']) ? true : false;
}
- public static function getFilename(ShoppingOrder $shopping_order){
+ public static function getFilename($shopping_order){
return isset($shopping_order->invoice['filename']) ? $shopping_order->invoice['filename'] : false;
}
- public static function getDir(ShoppingOrder $shopping_order){
+ public static function getDir($shopping_order){
return isset($shopping_order->invoice['dir']) ? $shopping_order->invoice['dir'] : false;
}
+ public static function getDate($shopping_order){
+ return isset($shopping_order->invoice['invoice_date']) ? $shopping_order->invoice['invoice_date'] : false;
+ }
+
+ public static function getNumber($shopping_order){
+ return isset($shopping_order->invoice['invoice_number']) ? $shopping_order->invoice['invoice_number'] : false;
+ }
+
public static function getDownloadURL(ShoppingOrder $shopping_order, $do = false){
- return route('storage_file', [$shopping_order->id, 'cms_download_file', $do]);
+ // return route('storage_file', [$shopping_order->id, 'cms_download_file', $do]);
}
public static function getDownloadPath(ShoppingOrder $shopping_order, $full = false){
$dir = self::getDir($shopping_order);
diff --git a/app/Services/Payment.php b/app/Services/Payment.php
index 3f965f2..ff89cf2 100644
--- a/app/Services/Payment.php
+++ b/app/Services/Payment.php
@@ -165,15 +165,24 @@ class Payment
$date = \Carbon::parse($user->payment_account)->modify('1 year');
}
foreach ($shopping_order_item->product->action as $do){
- if($shopping_order_item->product->getActionName($do) === 'payment_for_account'){
+ if($shopping_order_item->product->getActionName($do) === 'payment_for_account' && !$shopping_order_item->handle){
// $user->payment_order_id = $shopping_order_item->product->id; //34
$user->payment_account = $date;
$user->wizard = 100;
$user->save();
- self::addUserPayCredits($user, $shopping_order_item->product->price, 1, 'payment_for_account', $shopping_order->id);
+ self::addUserPayCredits($user, $shopping_order_item->product->price, 1, 'payment_for_account', $shopping_order->id);
+ $shopping_order_item->handle = true;
+ $shopping_order_item->save();
$shopping_order->setUserHistoryValue(['status' => 9]);
}
+ if($shopping_order_item->product->getActionName($do) === 'charging_credits' && !$shopping_order_item->handle){
+ self::addUserPayCredits($user, ($shopping_order_item->product->price * $shopping_order_item->qty), 7, 'charging_credits_add', $shopping_order->id);
+ $shopping_order_item->handle = true;
+ $shopping_order_item->save();
+ $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;
@@ -199,7 +208,7 @@ class Payment
}
//if the order has action
- if($shopping_order->shopping_user->is_from === 'user_order'){
+ if($shopping_order->shopping_user->is_from === 'user_order' && $shopping_order->shopping_order_margin){
//is margin -> set paid
$shopping_order->shopping_order_margin->paid = true;
$shopping_order->shopping_order_margin->save();
@@ -228,23 +237,54 @@ class Payment
'price' => $promotion_admin_product->getPriceWith(false),
'price_net' => $promotion_admin_product->getPriceWith(true),
'tax_rate' => $promotion_admin_product->product->tax,
+ 'status' => 0,
+ 'pick_up' => $shopping_order->isPickUp()
]);
$promotion_user_product->open_items -= $PromotionUserOrder->qty;
$promotion_user_product->sell_items += $PromotionUserOrder->qty;
$promotion_user_product->used_budget_total += $PromotionUserOrder->price;
$promotion_user_product->save();
-
- //TODO Guthaben abziehen
- self::addUserPayCredits($promotion_user_product->promotion_user->user, ($PromotionUserOrder->price*-1), 5, 'promotion_order_deduction', $shopping_order->id);
+
+ //Guthaben abziehen wenn nicht abholung
+ if(!$shopping_order->isPickUp()){
+ self::addUserPayCredits($promotion_user_product->promotion_user->user, ($PromotionUserOrder->price*-1), 5, 'promotion_order_deduction', $shopping_order->id);
+ }
}
}
}
}
-
+ //remove or add form credit, is from Charging credits, handle is true (by paymentStatusPaidAction first action by paid)
+ public static function handelUserPayChargingCredits(ShoppingOrder $shopping_order, $action){
+ //only from cr <- credit Charging
+ if($shopping_order->shopping_user->is_for !== 'cr'){
+ return;
+ }
+ if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
+ foreach($shopping_order->shopping_order_items as $shopping_order_item){
+ if($shopping_order_item->product){
+ $user = User::findOrFail($shopping_order->auth_user_id);
+ //product action
+ if($shopping_order_item->product->action){
+ foreach ($shopping_order_item->product->action as $do){
+ if($shopping_order_item->product->getActionName($do) === 'charging_credits' && $shopping_order_item->handle){
+ if($action === 'remove'){
+ self::addUserPayCredits($user, ($shopping_order_item->product->price*-1), 8, 'charging_credits_remove', $shopping_order->id);
+ }
+ if($action === 'add'){
+ self::addUserPayCredits($user, $shopping_order_item->product->price, 7, 'charging_credits_add', $shopping_order->id);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
//remove form credit, every sale fnc / vor / etc from CheckoutController
- //when stone, put it back SalesController
+ //when done, put it back SalesController
public static function handelUserPayCredits(ShoppingOrder $shopping_order, $do){
//is payment credit, deduction or return
if(!$shopping_order->shopping_order_margin){
@@ -261,8 +301,51 @@ class Payment
$credit = $shopping_order->shopping_order_margin->from_payment_credit;
self::addUserPayCredits($shopping_order->auth_user, $credit, 4, 'user_order_return', $shopping_order->id);
}
+ }
+ }
+
+ public static function handelUserPromotionOrder(ShoppingOrder $shopping_order){
+ //no user promotion
+ if($shopping_order->payment_for !== 7 || !$shopping_order->promotion_user){
+ return;
}
-
+ if($shopping_order->promotion_user->promotion_user_orders){
+ foreach($shopping_order->promotion_user->getPromotionUserOrders($shopping_order->id) as $promotion_user_order){
+ $promotion_user_order->setStatusShipped($shopping_order->getAPIShippedType());
+ if(!$promotion_user_order->pick_up){ // keine abholung handel credit
+ $last_UserPayCredit = UserPayCredit::where('shopping_order_id', $shopping_order->id)->whereIn('status', [5, 6])->orderBy('id', 'DESC')->first();
+ if($last_UserPayCredit && $promotion_user_order->status === 10 && $last_UserPayCredit->status === 5){
+ Payment::handelUserPayCreditsPromotion($promotion_user_order, 'return');
+ }
+ //Status Zahlung, voher gab es eine Storno, Guthaben abziehen wenn status 6 / return from order
+ if($last_UserPayCredit && $promotion_user_order->status === 0 && $last_UserPayCredit->status === 6){
+ Payment::handelUserPayCreditsPromotion($promotion_user_order, 'deduction');
+ }
+ }
+ }
+ }
+ }
+
+ //add or remove form credit,
+ //when done, put it back SalesController
+ public static function handelUserPayCreditsPromotion(PromotionUserOrder $promotion_user_order, $do){
+ //is promotion pick up, dont
+ if($promotion_user_order->pick_up){
+ return;
+ }
+ if($do === 'deduction'){
+ if($promotion_user_order->price > 0){
+ $credit = $promotion_user_order->price * -1;
+ self::addUserPayCredits($promotion_user_order->promotion_user->user, $credit, 5, 'promotion_order_deduction', $promotion_user_order->shopping_order->id);
+ }
+ }
+ if($do === 'return'){
+ if($promotion_user_order->price > 0){
+ $credit = $promotion_user_order->price;
+ self::addUserPayCredits($promotion_user_order->promotion_user->user, $credit, 6, 'promotion_order_return', $promotion_user_order->shopping_order->id);
+ }
+ }
+
}
public static function paymentStatusSendMail(ShoppingOrder $shopping_order, $shopping_payment, $data){
@@ -284,6 +367,7 @@ class Payment
if(!$shopping_order->shopping_user->is_like && $shopping_order->shopping_user->member){
$bcc[] = $shopping_order->shopping_user->member->email;
}
+
Mail::to($billing_email)->bcc($bcc)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $data['send_link'], $data['mode']));
}
}
diff --git a/app/Services/PromotionCart.php b/app/Services/PromotionCart.php
index 429b5f8..b455536 100644
--- a/app/Services/PromotionCart.php
+++ b/app/Services/PromotionCart.php
@@ -24,8 +24,16 @@ class PromotionCart
Yard::instance('shopping')->setShippingCountryWithPrice($id, 'shop');
}
- public static function getLowestShippingPrice($shipping_for = 2)
+ public static function getCurrentShippingPrice($shipping_for = 2) //shipping_for === microsite
{
+ $shipping = Yard::instance('shopping')->shipping();
+ if($shipping > 0){
+ return $shipping;
+ }
+ $shipping = Yard::instance('shopping')->preCalcuShippingPrice();
+ if($shipping > 0){
+ return formatNumber($shipping);
+ }
if($ShippingCountry = ShippingCountry::all()->first()){
if($ShippingCountry->shipping){
if($ShippingPrices = $ShippingCountry->shipping->getShippingPricesFirstBy($shipping_for)){
@@ -85,7 +93,6 @@ class PromotionCart
Yard::instance('shopping')->remove($cartItem->rowId);
}
}
-
Yard::instance('shopping')->reCalculate();
return $cartItem->qty;
}
@@ -118,6 +125,8 @@ class PromotionCart
'product_id' => $product->id
]);
Yard::setTax($cartItem->rowId, 0);
+ Yard::instance('shopping')->reCalculate();
+
}
}
}
diff --git a/app/Services/Type.php b/app/Services/Type.php
index c41f37d..3955601 100644
--- a/app/Services/Type.php
+++ b/app/Services/Type.php
@@ -13,7 +13,7 @@ class Type
3 => 'Registrierung / Mitgliedschaft Vertriebspartner',
4 => 'Nur Mitgliedschaft Vertriebspartner',
//5 => 'Onboarding Vertriebspartner',
- //6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop',
+ 6 => 'Guthaben aufladen',
7 => 'zur internen Berechnung',
];
@@ -24,7 +24,7 @@ class Type
3 => 'Microsite',
4 => 'Registrierung Vertriebspartner',
5 => 'Mitgliedschaft Vertriebspartner',
- //6 => 'Onboarding Berater',
+ 6 => 'Guthaben aufladen',
10 => 'zur internen Berechnung',
];
@@ -45,7 +45,7 @@ class Type
3 => 'Microsite',
4 => 'Registrierung Vertriebspartner',
5 => 'Mitgliedschaft Vertriebspartner',
- //6 => 'Onboarding Berater',
+ 6 => 'Guthaben aufladen',
10 => 'überall',
];
diff --git a/app/Services/Util.php b/app/Services/Util.php
index da149de..9819607 100644
--- a/app/Services/Util.php
+++ b/app/Services/Util.php
@@ -8,8 +8,6 @@ use Yard;
class Util
{
-
-
private static $postRoute = 'base.';
public static function getToken()
diff --git a/app/Services/Yard.php b/app/Services/Yard.php
index abb234f..93b3753 100644
--- a/app/Services/Yard.php
+++ b/app/Services/Yard.php
@@ -121,6 +121,11 @@ class Yard extends Cart
$this->putYardExtra('global_tax_rate', $this->global_tax_rate);
}
+ public function getGlobalTaxRate(){
+ $this->global_tax_rate;
+
+ }
+
public function setShippingOption($value){
$this->shipping_option = $value;
$this->putYardExtra('shipping_option', $this->shipping_option);
@@ -199,6 +204,10 @@ class Yard extends Cart
/* * ***** */
public function calculateMargins(){
+
+ if($this->shipping_is_for === 'cr'){
+ return;
+ }
//get user monthy amount
$monthy_amount = UserMarign::getMontlyAmount($this->user);
@@ -288,7 +297,6 @@ class Yard extends Cart
$margin->setCommission($this->yard_commission);
$margin->calculate();
-
$this->yard_margin = $margin;
$this->putYardExtra('yard_margin', $this->yard_margin);
@@ -319,18 +327,17 @@ class Yard extends Cart
$this->payment_credit = $payment_credit;
$this->putYardExtra('user', $user);
$this->putYardExtra('payment_credit', $payment_credit);
-
}
public function getPaymentCredit(){
if($this->payment_credit && $this->user->payment_credit > 0){
return $this->user->payment_credit;
}
- return 0;
+ return false;
}
private function calculateShippingPrice(){
-
+ //keine Verandkosten
if($this->shipping_option && $this->shipping_option === 'pick_up'){
$this->shipping_price = 0;
$this->shipping_tax_rate = 0;
@@ -339,6 +346,15 @@ class Yard extends Cart
$this->putShippingPrices();
return;
}
+ //keine Verandkosten
+ if($this->shipping_is_for === 'cr' || $this->shipping_is_for === 'mp'){
+ $this->shipping_price = 0;
+ $this->shipping_tax_rate = 0;
+ $this->shipping_price_net = 0;
+ $this->shipping_tax = 0;
+ $this->putShippingPrices();
+ return;
+ }
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if(!$shippingCountry){
@@ -396,6 +412,42 @@ class Yard extends Cart
}
}
+ public function preCalcuShippingPrice(){
+ $shippingCountry = ShippingCountry::find($this->shipping_country_id);
+ if(!$shippingCountry){
+ return false;
+ }
+ $shipping = $shippingCountry->shipping;
+ $shipping_price_for = 1;
+ if($this->shipping_is_for === 'shop'){
+ $shipping_price_for = 2;
+ }
+ if($this->weight() == 0){
+ $shipping_price = $shipping->getShippingPricesBy($shipping_price_for)->first();
+ if(!$shipping_price){
+ $shipping_price = new \App\Models\ShippingPrice();
+ }
+ $shipping_price->price = 0;
+ }else{
+ //first by price
+ $shipping_price = $this->shippingPriceBySubTotal($shipping->getShippingPricesBy($shipping_price_for), $this->subtotal(2, '.', ''));
+ //sec by weight
+ if(!$shipping_price){
+ $shipping_price = $this->shippingPriceByWeight($shipping->getShippingPricesBy($shipping_price_for), $this->weight());
+ }
+ //default
+ if(!$shipping_price){
+ $shipping_price = $shipping->getShippingPricesBy($shipping_price_for)->first();
+ }
+
+ }
+ if($shipping_price){
+ return $shipping_price->price;
+ }
+ return false;
+
+ }
+
private function putShippingPrices(){
$this->putYardExtra('num_comp', $this->num_comp);
$this->putYardExtra('shipping_price', $this->shipping_price);
diff --git a/app/User.php b/app/User.php
index 5e396a6..d4b7b94 100644
--- a/app/User.php
+++ b/app/User.php
@@ -479,7 +479,7 @@ class User extends Authenticatable
*/
public function sendPasswordResetNotification($token)
{
- Mail::to($this->email)->send(new MailResetPassword($token, $this));
+ Mail::to($this->email)->bcc(config('app.info_mail'))->send(new MailResetPassword($token, $this));
// $this->notify(new ResetPasswordNotification($token));
}
}
diff --git a/database/migrations/2020_12_23_163724_create_shopping_order_items_table.php b/database/migrations/2020_12_23_163724_create_shopping_order_items_table.php
index 5f937ca..30a22e9 100644
--- a/database/migrations/2020_12_23_163724_create_shopping_order_items_table.php
+++ b/database/migrations/2020_12_23_163724_create_shopping_order_items_table.php
@@ -29,6 +29,8 @@ class CreateShoppingOrderItemsTable extends Migration
$table->decimal('tax_rate', 5, 2)->nullable();
$table->string('slug')->nullable();
+ $table->boolean('handle')->default(false);
+
$table->timestamps();
$table->softDeletes();
$table->timestamp('user_deleted_at')->nullable();
diff --git a/database/migrations/2021_12_01_160513_create_promotion_user_orders_table.php b/database/migrations/2021_12_01_160513_create_promotion_user_orders_table.php
index 179900a..3fb3b68 100644
--- a/database/migrations/2021_12_01_160513_create_promotion_user_orders_table.php
+++ b/database/migrations/2021_12_01_160513_create_promotion_user_orders_table.php
@@ -28,7 +28,7 @@ class CreatePromotionUserOrdersTable extends Migration
$table->decimal('price', 8, 2)->nullable();
$table->decimal('price_net', 8, 3)->nullable();
$table->decimal('tax_rate', 5, 2)->nullable();
-
+ $table->boolean('pick_up')->default(false);
$table->unsignedTinyInteger('status')->index()->default(0);
$table->foreign('promotion_admin_id')
diff --git a/public/js/iq-promotion-cart.js b/public/js/iq-promotion-cart.js
index d94f52a..76849ee 100644
--- a/public/js/iq-promotion-cart.js
+++ b/public/js/iq-promotion-cart.js
@@ -86,7 +86,7 @@ var IqPromotionCart = {
},
update_poduct_price: function(){
- console.log("s");
+ //console.log("s");
var _self = this;
$('.calculate_product_qty_price_total').each(function(){
@@ -125,7 +125,7 @@ var IqPromotionCart = {
})
.done(function (data) {
// console.log('performRequest');
- // console.log(data);
+ //console.log(data);
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(jqXHR.responseText);
diff --git a/public/js/iq-promotion-shop-cart.js b/public/js/iq-promotion-shop-cart.js
index 4dca58d..d1577fe 100644
--- a/public/js/iq-promotion-shop-cart.js
+++ b/public/js/iq-promotion-shop-cart.js
@@ -178,7 +178,7 @@ var IqPromotionShopCart = {
var _self = this;
var url = _self.url;
data.perform = true;
- _log(data);
+ //_log(data);
// _log(url);
return $.ajax({
url: url,
@@ -193,8 +193,8 @@ var IqPromotionShopCart = {
}
})
.done(function (data) {
- _log('performRequest');
- _log(data);
+ //_log('performRequest');
+ //_log(data);
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(jqXHR.responseText);
diff --git a/public/js/iq-shopping-cart.js b/public/js/iq-shopping-cart.js
index 21a421e..3b2f38e 100755
--- a/public/js/iq-shopping-cart.js
+++ b/public/js/iq-shopping-cart.js
@@ -154,11 +154,9 @@ var IqShoppingCart = {
var _self = this;
var url = _self.url,
contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
-
data.shipping_is_for = _self.is_for;
- console.log(data);
- console.log(url);
-
+ //console.log(data);
+ //console.log(url);
return $.ajax({
url: url,
data: data,
@@ -172,12 +170,8 @@ var IqShoppingCart = {
}
})
.done(function (data) {
-
- console.log('performRequest');
- console.log(data);
-
-
-
+ //console.log('performRequest');
+ //console.log(data);
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(jqXHR.responseText);
diff --git a/resources/lang/de/email.php b/resources/lang/de/email.php
index 553accc..8030f70 100644
--- a/resources/lang/de/email.php
+++ b/resources/lang/de/email.php
@@ -50,7 +50,7 @@
'credit_title' => 'Gutschrift aus Vertriebspartnerbestellungen auf Grüne Seele',
'invoice_copy1line' => 'vielen Dank für Deine Bestellung bei Grüne Seele. Nachfolgend senden wir Dir die Rechnung zu deiner Bestellung: ',
'credit_copy1line' => 'vielen Dank für Deine Vertriebspartnerschaft bei Grüne Seele. Nachfolgend senden wir Dir Deine Gutschrift zu. Der Betrag wird zeitnah angewiesen, bitte prüfen deine Zahlungsdaten in deinem Konto: Mein Konto -> Meine Daten .',
- 'footer_copy1' => 'GRÜNE SEELE GmbH | Hauptstrasse 174 | 51143 Köln | Telefon: (+49) 2203 183 86 14 | E-Mail: service@gruene-seele.bio',
+ 'footer_copy1' => 'GRÜNE SEELE GmbH | Hauptstr. 174 | 51143 Köln | Telefon: (+49) 2203 183 86 14 | E-Mail: service@gruene-seele.bio',
'footer_copy2' => '',
'footer_copy3' => '© 2022 All Rights Reserved',
'checkout_mail_hl1' => 'Du hast folgende Artikel bestellt:',
@@ -58,6 +58,8 @@
'checkout_mail_status_info' => 'Statusinfo:',
'checkout_mail_subtotal_ws' => 'Summe ohne MwSt.',
'checkout_mail_tax' => 'zzgl. MwSt',
+ 'checkout_mail_tax_19' => 'zzgl. 19% MwSt',
+ 'checkout_mail_tax_7' => 'zzgl. 7% MwSt',
'checkout_mail_total' => 'Gesamtpreis',
'checkout_mail_tax_info' => 'Preis inkl. MwSt',
'checkout_mail_pay_info' => 'Zahlungsinfo:',
diff --git a/resources/lang/de/navigation.php b/resources/lang/de/navigation.php
index a1ef0eb..0a10c8e 100755
--- a/resources/lang/de/navigation.php
+++ b/resources/lang/de/navigation.php
@@ -49,4 +49,6 @@ return [
'promotion' => 'Promotion',
'my_promotions' => 'Meine Promotions',
'my_profile' => 'Mein Profil',
+ 'recharge_credit'=>'Guthaben aufladen',
+
];
diff --git a/resources/views/_bak/web/templates/checkout.blade.php b/resources/views/_bak/web/templates/checkout.blade.php
index be0a02f..440387f 100644
--- a/resources/views/_bak/web/templates/checkout.blade.php
+++ b/resources/views/_bak/web/templates/checkout.blade.php
@@ -411,10 +411,10 @@
@if($shopping_user->is_from === 'user_order')
- @if($shopping_user->is_for === 'me')
-
Meine Lieferadresse
- @else
+ @if($shopping_user->is_for === 'ot')
Lieferadresse des Kunden
+ @else
+ Meine Lieferadresse
@endif
@else
Lieferadresse
@@ -513,7 +513,7 @@
{!! HTMLHelper::getCountriesForShipping($shopping_user->shipping_state) !!}
- @if($is_from === 'user_order' && $is_for === 'me')
+ @if($is_from === 'user_order' && ($is_for === 'me' || $is_for === 'mp' || $is_for === 'cr'))
Das Lieferland kann nur bei der Bestellübersicht geändert werden.
@else
Bei der Änderung des Landes werden die Versandkosten neu berechnet.
@@ -852,7 +852,7 @@
Jetzt kaufen
- Sind alle Deine Angaben vollsätndig ausgefüllt, klicke auf "Jetzt kaufen" und Du wist zu unserem Zahlungsanbieter weitergeleitet, die Verbindung wird ist SSL verschlüsselt.
+ Sind alle Deine Angaben vollständig ausgefüllt, klicke auf "Jetzt kaufen" und Du wist zu unserem Zahlungsanbieter weitergeleitet, die Verbindung wird ist SSL verschlüsselt.
diff --git a/resources/views/admin/modal/add_credit.blade.php b/resources/views/admin/modal/add_credit.blade.php
index 9f2edd0..73e04e2 100644
--- a/resources/views/admin/modal/add_credit.blade.php
+++ b/resources/views/admin/modal/add_credit.blade.php
@@ -33,7 +33,7 @@
{!! Form::close() !!}
diff --git a/resources/views/admin/modal/add_pay_credit.blade.php b/resources/views/admin/modal/add_pay_credit.blade.php
index e5f878a..047591b 100644
--- a/resources/views/admin/modal/add_pay_credit.blade.php
+++ b/resources/views/admin/modal/add_pay_credit.blade.php
@@ -33,7 +33,7 @@
{!! Form::close() !!}
diff --git a/resources/views/admin/payment/credit/index.blade.php b/resources/views/admin/payment/credit/index.blade.php
index 1b407ed..f27a16b 100755
--- a/resources/views/admin/payment/credit/index.blade.php
+++ b/resources/views/admin/payment/credit/index.blade.php
@@ -237,7 +237,7 @@
diff --git a/resources/views/admin/payment/invoice/index.blade.php b/resources/views/admin/payment/invoice/index.blade.php
index ea9657d..fbb7119 100755
--- a/resources/views/admin/payment/invoice/index.blade.php
+++ b/resources/views/admin/payment/invoice/index.blade.php
@@ -30,6 +30,7 @@
{{__('Betrag') }}
{{__('Datum') }}
{{__('Status')}}
+ {{__('Art')}}
{{__('Order')}}
@@ -63,6 +64,7 @@
{ data: 'total_shipping', name: 'total_shipping' },
{ data: 'created_at', name: 'shopping_orders.created_at' },
{ data: 'txaction', name: 'txaction', searchable: false },
+ { data: 'payment_for', name: 'payment_for' },
{ data: 'shipping_order', name: 'shipping_order', orderable: false },
],
"bLengthChange": false,
diff --git a/resources/views/admin/product/form.blade.php b/resources/views/admin/product/form.blade.php
index 2feb38f..170529f 100755
--- a/resources/views/admin/product/form.blade.php
+++ b/resources/views/admin/product/form.blade.php
@@ -339,7 +339,6 @@
-
@if(Auth::user()->isSySAdmin())
+
+
+
{!! Form::close() !!}
@endsection
diff --git a/resources/views/emails/_checkout_product_list.blade.php b/resources/views/emails/_checkout_product_list.blade.php
index 1b9fa9e..8aea62e 100644
--- a/resources/views/emails/_checkout_product_list.blade.php
+++ b/resources/views/emails/_checkout_product_list.blade.php
@@ -3,10 +3,10 @@
@if($shopping_order->shopping_user->is_from === 'user_order')
- @if($shopping_order->shopping_user->is_for === 'me')
- {{__('email.checkout_mail_order_for_me')}}
- @else
+ @if($shopping_order->shopping_user->is_for === 'ot')
{{__('email.checkout_mail_order_for_ot')}}
+ @else
+ {{__('email.checkout_mail_order_for_me')}}
@endif
@endif
@if($shopping_order->shopping_user->is_from === 'wizard')
diff --git a/resources/views/emails/checkout.blade.php b/resources/views/emails/checkout.blade.php
index 437afc6..c126741 100644
--- a/resources/views/emails/checkout.blade.php
+++ b/resources/views/emails/checkout.blade.php
@@ -232,13 +232,39 @@
+ @if($shopping_order->isPickUp())
+
+
+ {{__('email.checkout_mail_pickup_addess')}}
+
+
+
+
+
+
+
+ @if($shopping_order->promotion_user)
+ {!! nl2br($shopping_order->promotion_user->user_address) !!}
+ @endif
+
+
+
+
+
+
+
+
+
+
+
+ @else
@if($shopping_order->shopping_user->is_from === 'user_order')
- @if($shopping_order->shopping_user->is_for === 'me')
- {{__('email.checkout_mail_deliver_addess')}}
- @else
+ @if($shopping_order->shopping_user->is_for === 'ot')
{{__('email.checkout_mail_deliver_customer')}}
+ @else
+ {{__('email.checkout_mail_deliver_addess')}}
@endif
@else
{{__('email.checkout_mail_deliver_addess')}}
@@ -282,37 +308,12 @@
+ @endif
- @if($shopping_order->shipping_option === 'pick_up')
-
-
- {{__('email.checkout_mail_pickup_addess')}}
-
-
-
-
-
-
-
- @if($shopping_order->promotion_user)
- {!! nl2br($shopping_order->promotion_user->user_address) !!}
- @endif
-
-
-
-
-
-
-
-
-
-
-
- @endif
@@ -373,7 +374,6 @@
{{ $shopping_order->shopping_user->billing_firstname }}
{{ $shopping_order->shopping_user->billing_lastname }}
-
{{ $shopping_order->shopping_user->billing_address }}
@if($shopping_order->shopping_user->billing_address_2)
@@ -394,7 +394,6 @@
{{ $shopping_order->shopping_user->shipping_firstname }}
{{ $shopping_order->shopping_user->shipping_lastname }}
-
{{ $shopping_order->shopping_user->shipping_address }}
@if($shopping_order->shopping_user->shipping_address_2)
@@ -468,6 +467,9 @@
{{__('email.footer_copy2')}}
+ AGB •
+ Widerrufsbelehrung •
+ Impressum •
Datenschutzerklärung
{{__('email.footer_copy3')}}
diff --git a/resources/views/emails/checkout_status.blade.php b/resources/views/emails/checkout_status.blade.php
index 383f1a5..549b978 100644
--- a/resources/views/emails/checkout_status.blade.php
+++ b/resources/views/emails/checkout_status.blade.php
@@ -200,7 +200,6 @@
{{ $shopping_order->shopping_user->billing_firstname }}
{{ $shopping_order->shopping_user->billing_lastname }}
-
{{ $shopping_order->shopping_user->billing_address }}
@if($shopping_order->shopping_user->billing_address_2)
@@ -224,13 +223,39 @@
+ @if($shopping_order->isPickUp())
+
+
+ {{__('email.checkout_mail_pickup_addess')}}
+
+
+
+
+
+
+
+ @if($shopping_order->promotion_user)
+ {!! nl2br($shopping_order->promotion_user->user_address) !!}
+ @endif
+
+
+
+
+
+
+
+
+
+
+
+ @else
@if($shopping_order->shopping_user->is_from === 'user_order')
- @if($shopping_order->shopping_user->is_for === 'me')
- {{__('email.checkout_mail_deliver_addess')}}
- @else
+ @if($shopping_order->shopping_user->is_for === 'ot')
{{__('email.checkout_mail_deliver_customer')}}
+ @else
+ {{__('email.checkout_mail_deliver_addess')}}
@endif
@else
{{__('email.checkout_mail_deliver_addess')}}
@@ -251,7 +276,6 @@
{{ $shopping_order->shopping_user->shipping_firstname }}
{{ $shopping_order->shopping_user->shipping_lastname }}
-
{{ $shopping_order->shopping_user->shipping_address }}
@if($shopping_order->shopping_user->shipping_address_2)
@@ -273,38 +297,12 @@
+ @endif
- @if($shopping_order->shipping_option === 'pick_up')
-
-
- {{__('email.checkout_mail_pickup_addess')}}
-
-
-
-
-
-
-
- @if($shopping_order->promotion_user)
- {!! nl2br($shopping_order->promotion_user->user_address) !!}
- @endif
-
-
-
-
-
-
-
-
-
-
-
- @endif
-
@@ -334,29 +339,29 @@
@foreach($shopping_order->shopping_order_items as $shopping_order_item)
-
-
- {{ $shopping_order_item->product->name }}
-
-
- {{ $shopping_order_item->qty }}
-
-
- @if($shopping_order->shopping_user->is_from === 'user_order')
- {{ $shopping_order_item->getFormattedPriceNet() }} €
- @else
- {{ $shopping_order_item->getFormattedPrice() }} €
- @endif
-
-
- @if($shopping_order->shopping_user->is_from === 'user_order')
- {{ $shopping_order_item->getFormattedTotalPriceNet() }} €
- @else
- {{ $shopping_order_item->getFormattedTotalPrice() }} €
- @endif
-
-
- @endforeach
+
+
+ {{ $shopping_order_item->product->name }}
+
+
+ {{ $shopping_order_item->qty }}
+
+
+ @if($shopping_order->shopping_user->is_from === 'user_order')
+ {{ $shopping_order_item->getFormattedPriceNet() }} €
+ @else
+ {{ $shopping_order_item->getFormattedPrice() }} €
+ @endif
+
+
+ @if($shopping_order->shopping_user->is_from === 'user_order')
+ {{ $shopping_order_item->getFormattedTotalPriceNet() }} €
+ @else
+ {{ $shopping_order_item->getFormattedTotalPrice() }} €
+ @endif
+
+
+ @endforeach
@if($shopping_order->shopping_user->is_from === 'user_order')
@@ -368,6 +373,7 @@
{{ $shopping_order->getFormattedSubtotalFull() }} €*
+ @if($shopping_order->shopping_user->is_for !== 'cr')
@@ -386,6 +392,7 @@
{{ $shopping_order->getFormattedSubtotal() }} €*
+ @endif
@endif
@@ -413,7 +420,12 @@
- {{__('email.checkout_mail_tax')}}
+ @if($shopping_order->isTax())
+ {{__('email.checkout_mail_tax_19')}}
+ @else
+ {{__('email.checkout_mail_tax')}}
+ @endif
+
{{ $shopping_order->getFormattedTax() }} €
@@ -438,11 +450,15 @@
{{ $shopping_order->getFormattedPaymentCredit() }} €
- @endif
+ @endif
- Gesamtsumme (Brutto):
+ @if($shopping_order->isTax())
+ Gesamtsumme (Brutto):
+ @else
+ Gesamtsumme:
+ @endif
{{ $shopping_order->getFormattedTotalShipping() }} €
@@ -460,9 +476,9 @@