parent
582ca8299d
commit
263cf93a1e
41 changed files with 812 additions and 288 deletions
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Input;
|
||||
use Session;
|
||||
use \SoapClient;
|
||||
|
||||
class KasController extends Controller
|
||||
{
|
||||
|
||||
|
||||
// Logindaten
|
||||
private $kas_user = 'w017f6e4'; // KAS-Logon
|
||||
private $kas_pass = '7mMJUF4YSVWNpp39'; // KAS-Passwort
|
||||
private $session_lifetime = 600; // Gültigkeit des Tokens in Sek. bis zur neuen Authentifizierung
|
||||
private $session_update_lifetime = 'Y'; // bei N läuft die Session nach <$session_lifetime> Sekunden ab, bei Y verlängert sich die Session mit jeder Benutzung
|
||||
private $CredentialToken = false;
|
||||
private $kas_flood_delay = 2;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->login();
|
||||
}
|
||||
|
||||
|
||||
public function action($func, $para = array()){
|
||||
|
||||
$this->checkSession($func);
|
||||
try
|
||||
{
|
||||
$Params = array(); // Parameter für die API-Funktion
|
||||
$SoapRequest = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
|
||||
$req = $SoapRequest->KasApi(json_encode(array(
|
||||
'KasUser' => $this->kas_user, // KAS-User
|
||||
'KasAuthType' => 'session', // Auth per Sessiontoken
|
||||
'KasAuthData' => $this->CredentialToken, // Auth-Token
|
||||
'KasRequestType' => $func, // API-Funktion
|
||||
'KasRequestParams' => $para // Parameter an die API-Funktion
|
||||
)));
|
||||
Session::put('flood_protection.'.$func, time() + $this->kas_flood_delay + 0.2);
|
||||
|
||||
if(isset($req['Response']['ReturnString']) && $req['Response']['ReturnString'] == "TRUE"){
|
||||
return $req['Response']['ReturnInfo'];
|
||||
}
|
||||
return $req;
|
||||
}
|
||||
|
||||
// Fehler abfangen und ausgeben
|
||||
catch (SoapFault $fault)
|
||||
{
|
||||
trigger_error(" Fehlernummer: {$fault->faultcode},
|
||||
Fehlermeldung: {$fault->faultstring},
|
||||
Verursacher: {$fault->faultactor},
|
||||
Details: {$fault->detail}", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function login(){
|
||||
|
||||
$this->checkSession('auth');
|
||||
try
|
||||
{
|
||||
|
||||
$SoapLogon = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasAuth.wsdl');
|
||||
$this->CredentialToken = $SoapLogon->KasAuth(json_encode(array(
|
||||
'KasUser' => $this->kas_user,
|
||||
'KasAuthType' => 'sha1',
|
||||
'KasPassword' => sha1($this->kas_pass),
|
||||
'SessionLifeTime' => $this->session_lifetime,
|
||||
'SessionUpdateLifeTime' => $this->session_update_lifetime
|
||||
)));
|
||||
Session::put('flood_protection.auth', time() + $this->kas_flood_delay + 0.2);
|
||||
|
||||
}
|
||||
|
||||
// Fehler abfangen und ausgeben
|
||||
catch (SoapFault $fault)
|
||||
{
|
||||
trigger_error("Fehlernummer: {$fault->faultcode},
|
||||
Fehlermeldung: {$fault->faultstring},
|
||||
Verursacher: {$fault->faultactor},
|
||||
Details: {$fault->detail}", E_USER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkSession($func)
|
||||
{
|
||||
$name = 'flood_protection.'.$func;
|
||||
|
||||
if(Session::exists($name)){
|
||||
$time_to_wait = (float)Session::get($name) - time();
|
||||
Session::forget($name);
|
||||
}else {
|
||||
$time_to_wait = 0;
|
||||
}
|
||||
if ( $time_to_wait >= 0 ) {
|
||||
usleep( intval( $time_to_wait*1000000 ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
130
app/Http/Controllers/BusinessPointsController.php
Normal file
130
app/Http/Controllers/BusinessPointsController.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Services\HTMLHelper;
|
||||
|
||||
class BusinessPointsController extends Controller
|
||||
{
|
||||
|
||||
private $startYear;
|
||||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
];
|
||||
return view('admin.payment.invoice', $data);
|
||||
}
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('invoice_filter_month')){
|
||||
session(['invoice_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('invoice_filter_year')){
|
||||
session(['invoice_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
if(Request::get('invoice_filter_name')){
|
||||
session(['invoice_filter_name' => Request::get('invoice_filter_name')]);
|
||||
}
|
||||
if(Request::get('invoice_filter_month')){
|
||||
session(['invoice_filter_month' => Request::get('invoice_filter_month')]);
|
||||
}
|
||||
if(Request::get('invoice_filter_year')){
|
||||
session(['invoice_filter_year' => Request::get('invoice_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
private function initSearch($archive = false, $request = true)
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
|
||||
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
|
||||
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
|
||||
|
||||
if(Request::get('invoice_filter_name')){
|
||||
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
}
|
||||
|
||||
//->orderBy('created_at', 'DESC');
|
||||
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
|
||||
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
|
||||
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
|
||||
})*/
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$query = $this->initSearch();
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order->auth_user_id){
|
||||
return '<a href="' . route('admin_sales_users_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
}
|
||||
return '<a href="' . route('admin_sales_customers_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
|
||||
})
|
||||
->addColumn('total_shipping', function (UserInvoice $UserInvoice) {
|
||||
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
|
||||
})
|
||||
->addColumn('created_at', function (UserInvoice $UserInvoice) {
|
||||
return $UserInvoice->created_at->format("d.m.Y");
|
||||
})
|
||||
/*
|
||||
->addColumn('shipping_order', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
foreach($UserInvoice->shopping_order_items as $shopping_order_item){
|
||||
$ret .= $shopping_order_item->product->name."<br>";
|
||||
}
|
||||
return $ret;
|
||||
})
|
||||
*/
|
||||
->addColumn('txaction', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order){
|
||||
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('status', function (UserInvoice $UserInvoice) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
|
||||
data-id="'.$UserInvoice->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
|
||||
<span class="badge badge-pill badge-'.$UserInvoice->getStatusColor().'">'.$UserInvoice->getStatusType().'</span>
|
||||
</a>';
|
||||
})
|
||||
->addColumn('invoice', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
|
||||
return $ret;
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('invoice_number', 'invoice_number $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -54,8 +54,8 @@ class MembershipController extends Controller
|
|||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'upgrade' => Product::where('active', true)->whereJsonContains('show_on', '5')->where('identifier', 'upgrade')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'upgrade' => Product::where('active', true)->whereJsonContains('show_on', '8')->where('identifier', 'upgrade')->get(),
|
||||
'diff_months' => $diff_months,
|
||||
'userHistoryPaymentOrder' => $userHistoryPaymentOrder,
|
||||
'userHistoryUpgradeOrder' => $userHistoryUpgradeOrder,
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ class ModalController extends Controller
|
|||
}
|
||||
$ret = view("admin.modal.is_like_member", compact('current', 'possibles', 'data'))->render();
|
||||
}
|
||||
if($data['action'] === 'shopping-order-change-points'){
|
||||
$value = ShoppingOrder::find($data['id']);
|
||||
$route = route('admin_sales_customers_detail', [$value->id]);
|
||||
$ret = view("admin.modal.change_points", compact('value', 'data', 'route'))->render();
|
||||
}
|
||||
if($data['action'] === 'user-order-show-product'){
|
||||
$product = Product::find($data['id']); //current user form order
|
||||
$ret = view("admin.modal.show_product", compact('product', 'data'))->render();
|
||||
|
|
@ -61,13 +66,24 @@ class ModalController extends Controller
|
|||
if($data['action'] === 'shop-user-order-detail'){
|
||||
$user = \Auth::user();
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
if(!$user->isAdmin() || $shopping_order->member_id !== $user->id){
|
||||
if(!$user->isAdmin() && $shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
$isAdmin = false ;
|
||||
$ret = view("user.shop.sales.modal_api_order_detail", compact('shopping_order', 'isAdmin', 'data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === 'shop-user-order-shipping-detail'){
|
||||
$user = \Auth::user();
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
if(!$user->isAdmin() && $shopping_order->auth_user_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
$isAdmin = false ;
|
||||
$ret = view("user.shop.sales.modal_api_order_shipping_detail", compact('shopping_order', 'isAdmin', 'data'))->render();
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === 'user-order-my-delivery-show'){
|
||||
$user = \Auth::user();
|
||||
$ret = view("admin.modal.show_user_customers", compact('user', 'data'))->render();
|
||||
|
|
|
|||
130
app/Http/Controllers/PaymentPointsController.php
Normal file
130
app/Http/Controllers/PaymentPointsController.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Services\HTMLHelper;
|
||||
|
||||
class PaymentPointsController extends Controller
|
||||
{
|
||||
|
||||
private $startYear;
|
||||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
];
|
||||
return view('admin.payment.invoice', $data);
|
||||
}
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('invoice_filter_month')){
|
||||
session(['invoice_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('invoice_filter_year')){
|
||||
session(['invoice_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
if(Request::get('invoice_filter_name')){
|
||||
session(['invoice_filter_name' => Request::get('invoice_filter_name')]);
|
||||
}
|
||||
if(Request::get('invoice_filter_month')){
|
||||
session(['invoice_filter_month' => Request::get('invoice_filter_month')]);
|
||||
}
|
||||
if(Request::get('invoice_filter_year')){
|
||||
session(['invoice_filter_year' => Request::get('invoice_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
private function initSearch($archive = false, $request = true)
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
|
||||
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
|
||||
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
|
||||
|
||||
if(Request::get('invoice_filter_name')){
|
||||
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
}
|
||||
|
||||
//->orderBy('created_at', 'DESC');
|
||||
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
|
||||
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
|
||||
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
|
||||
})*/
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$query = $this->initSearch();
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order->auth_user_id){
|
||||
return '<a href="' . route('admin_sales_users_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
}
|
||||
return '<a href="' . route('admin_sales_customers_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
|
||||
})
|
||||
->addColumn('total_shipping', function (UserInvoice $UserInvoice) {
|
||||
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
|
||||
})
|
||||
->addColumn('created_at', function (UserInvoice $UserInvoice) {
|
||||
return $UserInvoice->created_at->format("d.m.Y");
|
||||
})
|
||||
/*
|
||||
->addColumn('shipping_order', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
foreach($UserInvoice->shopping_order_items as $shopping_order_item){
|
||||
$ret .= $shopping_order_item->product->name."<br>";
|
||||
}
|
||||
return $ret;
|
||||
})
|
||||
*/
|
||||
->addColumn('txaction', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order){
|
||||
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
|
||||
}
|
||||
return "-";
|
||||
})
|
||||
->addColumn('status', function (UserInvoice $UserInvoice) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
|
||||
data-id="'.$UserInvoice->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
|
||||
<span class="badge badge-pill badge-'.$UserInvoice->getStatusColor().'">'.$UserInvoice->getStatusType().'</span>
|
||||
</a>';
|
||||
})
|
||||
->addColumn('invoice', function (UserInvoice $UserInvoice) {
|
||||
$ret = "";
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
|
||||
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
|
||||
|
||||
return $ret;
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('invoice_number', 'invoice_number $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ use App\Models\ShoppingPayment;
|
|||
use App\Models\PaymentTransaction;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
|
@ -33,6 +34,10 @@ class SalesController extends Controller
|
|||
public function usersDetail($id)
|
||||
{
|
||||
$ShoppingOrder = ShoppingOrder::find($id);
|
||||
if( $ShoppingOrder->payment_for === 6 || $ShoppingOrder->payment_for === 7){
|
||||
return redirect(route('admin_sales_customers_detail', [$ShoppingOrder->id]));
|
||||
abort(403, 'Kundenbestellung');
|
||||
}
|
||||
if($ShoppingOrder->shipped === 0){
|
||||
$ShoppingOrder->shipped = 1;
|
||||
$ShoppingOrder->save();
|
||||
|
|
@ -77,6 +82,15 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->payment_for === 8){
|
||||
return '<button type="button" class="btn btn-xs btn-info btn-round" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$ShoppingOrder->id.'"
|
||||
data-action="shop-user-order-shipping-detail"
|
||||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
|
|
@ -118,7 +132,7 @@ class SalesController extends Controller
|
|||
set_user_attr('filter_member_id', null);
|
||||
return redirect(route('admin_sales_customers'));
|
||||
}
|
||||
$filter_user_shops = ShoppingOrder::join('user_shops', 'user_shop_id', '=', 'user_shops.id')->get()->pluck('slug', 'id')->unique()->toArray();
|
||||
$filter_user_shops = ShoppingOrder::join('user_shops', 'user_shop_id', '=', 'user_shops.id')->orderBy('slug')->get()->pluck('slug', 'id')->unique()->toArray();
|
||||
$filter_members = ShoppingOrder::join('users', 'member_id', '=', 'users.id')->groupBy('member_id')->join('user_accounts', 'account_id', '=', 'user_accounts.id')->select('users.id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')->get(); //->pluck('email', 'id')->unique()->toArray();
|
||||
$data = [
|
||||
'filter_user_shops' => $filter_user_shops,
|
||||
|
|
@ -130,6 +144,10 @@ class SalesController extends Controller
|
|||
public function customersDetail($id)
|
||||
{
|
||||
$ShoppingOrder = ShoppingOrder::find($id);
|
||||
if( $ShoppingOrder->payment_for !== 6 && $ShoppingOrder->payment_for !== 7){
|
||||
return redirect(route('admin_sales_users_detail', [$ShoppingOrder->id]));
|
||||
abort(403, 'Beraterbestellung');
|
||||
}
|
||||
if($ShoppingOrder->shipped === 0){
|
||||
$ShoppingOrder->shipped = 1;
|
||||
$ShoppingOrder->save();
|
||||
|
|
@ -176,6 +194,20 @@ class SalesController extends Controller
|
|||
return redirect($data['back']);
|
||||
}
|
||||
}
|
||||
if($data['action']==='shopping-order-change-points'){
|
||||
if(!isset($data['change_member_key']) || $data['change_member_key'] !== config('mivita.edit_data_pass')){
|
||||
\Session()->flash('alert-error', 'Das Passwort ist falsch.');
|
||||
return back();
|
||||
}else{
|
||||
if(!isset($data['change_points'])){
|
||||
\Session()->flash('alert-error', 'Keine Änderung ausgewählt');
|
||||
return back();
|
||||
}
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
SalesPointsVolume::changeSalesPointsVolumeUser($shopping_order, $data['change_member_id']);
|
||||
return redirect(route('admin_sales_customers_detail', [$shopping_order->id]));
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'change_member_error' => $change_member_error,
|
||||
'shopping_order' => ShoppingOrder::find($id),
|
||||
|
|
@ -220,6 +252,12 @@ class SalesController extends Controller
|
|||
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()." €</span>";
|
||||
})
|
||||
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->txaction === 'extern_paid'){
|
||||
$shopping_oder_id = isset($ShoppingOrder->api_notice['shopping_order_id']) ? $ShoppingOrder->api_notice['shopping_order_id'] : null;
|
||||
if($shopping_oder_id){
|
||||
return '<a class="btn btn-xs btn-default btn-round" href="'.route('admin_sales_users_detail', [$shopping_oder_id]).'"><i class="fa fa-check fa-check-circle-o"> '.$shopping_oder_id.'</a>';
|
||||
}
|
||||
}
|
||||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
|
|
@ -229,7 +267,7 @@ class SalesController extends Controller
|
|||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
})
|
||||
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->txaction === 'extern' && $ShoppingOrder->wp_invoice_path){
|
||||
if(($ShoppingOrder->txaction === 'extern' || $ShoppingOrder->txaction === 'extern_paid') && $ShoppingOrder->wp_invoice_path){
|
||||
return '<span class="no-line-break"><a href="'.$ShoppingOrder->wp_invoice_path.'" class="btn btn-secondary btn-xs"><i class="fa fa-external-link-alt"></i> <i class="fa fa-download"></i></a> </div>';
|
||||
}
|
||||
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
|
||||
|
|
@ -264,7 +302,7 @@ class SalesController extends Controller
|
|||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
|
||||
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'payment_for', 'payment', 'total_shipping', 'invoice', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use App\Services\SyS\Cronjobs;
|
|||
use App\Services\SyS\Customers;
|
||||
use App\Services\SyS\DomainSSL;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\UserSalesVolume;
|
||||
use App\Services\SyS\Correction;
|
||||
use App\Services\SyS\ShoppingOrders;
|
||||
|
||||
|
|
@ -25,6 +26,21 @@ class SysController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
$UserSalesVolumes =UserSalesVolume::all();
|
||||
|
||||
foreach($UserSalesVolumes as $UserSalesVolume){
|
||||
if($UserSalesVolume->shopping_order->member_id !== NULL && $UserSalesVolume->user_id !== $UserSalesVolume->shopping_order->member_id){
|
||||
if($UserSalesVolume->shopping_order->member_id !== 6){
|
||||
dump($UserSalesVolume->shopping_order_id);
|
||||
dump($UserSalesVolume->shopping_order->member_id);
|
||||
dump($UserSalesVolume->user_id);
|
||||
|
||||
dump("##");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
dd("ebd");
|
||||
return view('sys.index');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ class HomepartyController extends Controller
|
|||
|
||||
public function datatable($homeparty_id){
|
||||
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '3');
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '4');
|
||||
$homeparty = Homeparty::findOrFail($homeparty_id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ class OrderController extends Controller
|
|||
if($shopping_order->auth_user_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
if( $shopping_order->payment_for === 6 || $shopping_order->payment_for === 7){
|
||||
return redirect(route('user_shop_order_detail', [$shopping_order->id]));
|
||||
abort(403, 'Kundenbestellung');
|
||||
}
|
||||
$shopping_order->getLastShoppingPayment();
|
||||
|
||||
$data = [
|
||||
|
|
@ -59,7 +63,7 @@ class OrderController extends Controller
|
|||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('user_order_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
return '<a href="'.route('user_order_detail', [$ShoppingOrder->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->created_at->format("d.m.Y");
|
||||
|
|
@ -74,6 +78,15 @@ class OrderController extends Controller
|
|||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->payment_for === 8){
|
||||
return '<button type="button" class="btn btn-xs btn-info btn-round" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$ShoppingOrder->id.'"
|
||||
data-action="shop-user-order-shipping-detail"
|
||||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
}
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
|
|
@ -277,7 +290,7 @@ class OrderController extends Controller
|
|||
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');
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '3');
|
||||
}
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
|
|
@ -465,7 +478,7 @@ class OrderController extends Controller
|
|||
|
||||
private function getCompProducts($for){
|
||||
if($for === 'me'){
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['1', '2', '3'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['1', '2', '3', '4'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ use App\Repositories\ShopApiRepository;
|
|||
class ShopApiController extends Controller
|
||||
{
|
||||
|
||||
private $api_action = [0 => 'bitte wählen', 'order' => 'markierte bestellen', 'remove' => 'markierte entfernen', 'reset' => 'markierte zurücksetzen/offen'];
|
||||
private $filter_show = [10 => 'alle anzeigen', 1 => 'offen', 2 => 'bestellt', 5 => 'entfernt'];
|
||||
private $api_action = [0 => 'bitte wählen', 'order' => 'markierte bezahlen', 'remove' => 'markierte entfernen', 'reset' => 'markierte zurücksetzen/bestellt'];
|
||||
private $filter_show = [10 => 'alle anzeigen', 1 => 'bestellt', 2 => 'bezahlt', 5 => 'entfernt'];
|
||||
protected $shopApiRepository;
|
||||
|
||||
public function __construct(ShopApiRepository $shopApiRepository)
|
||||
|
|
@ -28,7 +28,6 @@ class ShopApiController extends Controller
|
|||
public function orders()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$data = [
|
||||
'api_action' => $this->api_action,
|
||||
'filter_show' => $this->filter_show,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ class ShopSalesController extends Controller
|
|||
if($shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
if( $shopping_order->payment_for !== 6 && $shopping_order->payment_for !== 7){
|
||||
return redirect(route('user_order_detail', [$shopping_order->id]));
|
||||
abort(403, 'Beraterbestellung');
|
||||
}
|
||||
$data = [
|
||||
'shopping_order' => $shopping_order,
|
||||
'isAdmin' => false,
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
||||
];
|
||||
|
||||
|
|
@ -97,8 +97,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
if($step == 5){
|
||||
if($user->active){
|
||||
|
|
@ -139,8 +139,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => 0,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
||||
'yard_info' => UserService::getYardInfo(),
|
||||
];
|
||||
|
|
@ -192,8 +192,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
$user->wizard = 0;
|
||||
$user->save();
|
||||
|
|
@ -369,8 +369,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
$user->wizard = 10;
|
||||
$user->save();
|
||||
|
|
@ -408,8 +408,8 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
return view('user.wizard.create', $data)->withErrors($validator);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereNoCommission($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereShowOn($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @property string|null $ean
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereEan($value)
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
|
|
@ -208,12 +210,13 @@ class Product extends Model
|
|||
];
|
||||
|
||||
public $showONs = [
|
||||
1 => 'KundenShop',
|
||||
2 => 'BeraterShop',
|
||||
3 => 'Auszeitparty',
|
||||
4 => 'Registrierung Berater',
|
||||
5 => 'Mitgliedschaft Berater',
|
||||
6 => 'Onboarding Berater',
|
||||
1 => 'ShopKunde',
|
||||
2 => 'ShopBerater',
|
||||
3 => 'ShopBeraterKunden',
|
||||
4 => 'Auszeitparty',
|
||||
7 => 'Registrierung Berater',
|
||||
8 => 'Mitgliedschaft Berater',
|
||||
9 => 'Onboarding Berater',
|
||||
10 => 'zur internen Berechnung',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -152,9 +152,9 @@ class ShoppingOrder extends Model
|
|||
];
|
||||
|
||||
public static $apiStatusTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'offen / pre',
|
||||
2 => 'bestellt',
|
||||
0 => 'bestellt',
|
||||
1 => 'im Prozess',
|
||||
2 => 'bezahlt',
|
||||
5 => 'entfernt',
|
||||
];
|
||||
public static $apiStatusColors = [
|
||||
|
|
@ -180,7 +180,7 @@ class ShoppingOrder extends Model
|
|||
5 => 'Homeparty',
|
||||
6 => 'Shop',
|
||||
7 => 'extern',
|
||||
8 => 'Sammelbestellung',
|
||||
8 => 'Sammelrechnung',
|
||||
10 => '',
|
||||
];
|
||||
|
||||
|
|
@ -259,11 +259,11 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
public function user_sales_volume(){
|
||||
return $this->hasMany('App\Models\UserSalesVolume', 'shopping_order_id');
|
||||
return $this->hasOne('App\Models\UserSalesVolume', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function user_sales_volume_no_userid(){
|
||||
return $this->hasMany('App\Models\UserSalesVolume', 'shopping_order_id')->where('user_id', '=', NULL)->first();
|
||||
return $this->hasOne('App\Models\UserSalesVolume', 'shopping_order_id')->where('user_id', '=', NULL)->first();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -318,14 +318,13 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
public function getAPIStatusType(){
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? self::$apiStatusTypes[$this->api_status] : "offen";
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? self::$apiStatusTypes[$this->api_status] : "bestellt";
|
||||
}
|
||||
|
||||
public function getAPIStatusColor(){
|
||||
return isset(self::$apiStatusColors[$this->api_status]) ? self::$apiStatusColors[$this->api_status] : "warning";
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedTotal()
|
||||
{
|
||||
return formatNumber($this->attributes['total']);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ class UserSalesVolume extends Model
|
|||
'total_net' => 'float',
|
||||
'month_total_net' => 'float',
|
||||
'month_shop_total_net' => 'float',
|
||||
'status' => 'int'
|
||||
'status' => 'int',
|
||||
'syslog' => 'array'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
|
@ -94,15 +95,16 @@ class UserSalesVolume extends Model
|
|||
'month_total_net',
|
||||
'month_shop_total_net',
|
||||
'message',
|
||||
'status'
|
||||
'status',
|
||||
'syslog'
|
||||
];
|
||||
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'nicht zugewiesen',
|
||||
1 => 'hinzugefügt aus Bestellung',
|
||||
2 => 'hinzugefügt aus Shop',
|
||||
3 => 'hinzugefügt aus Shop / pending',
|
||||
1 => 'hinzugefügt aus Beraterbestellung',
|
||||
2 => 'hinzugefügt aus Shopbestellung',
|
||||
3 => 'hinzugefügt aus Shopbestellung / pending',
|
||||
10 => ''
|
||||
];
|
||||
|
||||
|
|
@ -135,42 +137,14 @@ class UserSalesVolume extends Model
|
|||
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
|
||||
}
|
||||
|
||||
public static function getStatusByOrder($ShoppingOrder){
|
||||
if($ShoppingOrder->payment_for){
|
||||
if($ShoppingOrder->payment_for === 6){ //Kunde-Shop
|
||||
if($ShoppingOrder->shopping_user && $ShoppingOrder->shopping_user->is_like){
|
||||
return 3; //shop Kunden, berater zuordnen
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getFormatedMonthYear(){
|
||||
return str_pad($this->month, 2, "0", STR_PAD_LEFT)."/".$this->year;
|
||||
}
|
||||
|
||||
public function setToUserAndCalculate($user_id){
|
||||
|
||||
$month = $this->month;
|
||||
$year = $this->year;
|
||||
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
|
||||
$month_shop_points += $this->points;
|
||||
$month_shop_total_net += $this->total_net;
|
||||
|
||||
$this->user_id = $user_id;
|
||||
$this->month_shop_points = $month_shop_points;
|
||||
$this->month_shop_total_net = $month_shop_total_net;
|
||||
$this->month_points = $month_points;
|
||||
$this->month_total_net = $month_total_net;
|
||||
$this->status = 2;
|
||||
$this->save();
|
||||
|
||||
public function isCurrentMonthYear(){
|
||||
if($this->month === intval(date('m')) && $this->year === intval(date('Y'))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ use App\Models\ShoppingOrder;
|
|||
use App\Services\MyPDFMerger;
|
||||
use App\Services\UserService;
|
||||
use App\Models\UserSalesVolume;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
|
||||
class InvoiceRepository extends BaseRepository {
|
||||
|
||||
|
|
@ -146,63 +147,12 @@ class InvoiceRepository extends BaseRepository {
|
|||
public function userSalesVolume()
|
||||
{
|
||||
|
||||
/*
|
||||
status
|
||||
1 => 'hinzugefügt aus Bestellung',
|
||||
2 => 'hinzugefügt aus Shop',
|
||||
3 => 'hinzugefügt aus Shop / pending',
|
||||
|
||||
*/
|
||||
$status = UserSalesVolume::getStatusByOrder($this->model);
|
||||
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
|
||||
//akuteller tag / Monat.
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$date = date('d.m.Y');
|
||||
|
||||
if($status === 3){ //shop bestellung User pending
|
||||
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
|
||||
$month_points = 0;
|
||||
$month_total_net = 0;
|
||||
$month_shop_points = 0;
|
||||
$month_shop_total_net = 0;
|
||||
}else{
|
||||
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
}
|
||||
switch ($status) {
|
||||
case 1: //Bestellung
|
||||
$month_points += $this->model->points;
|
||||
$month_total_net += $this->model->subtotal;
|
||||
break;
|
||||
case 2: //Shop
|
||||
$month_shop_points += $this->model->points;
|
||||
$month_shop_total_net += $this->model->subtotal;
|
||||
break;
|
||||
}
|
||||
|
||||
return UserSalesVolume::create([
|
||||
'user_id' => $user_id,
|
||||
'shopping_order_id' => $this->model->id,
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'date' => $date,
|
||||
'points' => $this->model->points,
|
||||
'month_points' => $month_points,
|
||||
'month_shop_points' => $month_shop_points,
|
||||
'total_net' => $this->model->subtotal,
|
||||
'month_total_net' => $month_total_net,
|
||||
'month_shop_total_net' => $month_shop_total_net,
|
||||
'message' => '',
|
||||
'status' => $status,
|
||||
]);
|
||||
}
|
||||
|
||||
public function createAndSalesVolume($request = [])
|
||||
{
|
||||
$this->user_sales_volume = $this->userSalesVolume();
|
||||
$this->user_sales_volume = SalesPointsVolume::addSalesPointsVolumeUser($this->model);
|
||||
$user_invoice = $this->create($request);
|
||||
$this->user_sales_volume->user_invoice_id = $user_invoice->id;
|
||||
$this->user_sales_volume->save();
|
||||
|
|
|
|||
166
app/Services/BusinessPlan/SalesPointsVolume.php
Normal file
166
app/Services/BusinessPlan/SalesPointsVolume.php
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
namespace App\Services\BusinessPlan;
|
||||
|
||||
use App\User;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserSalesVolume;
|
||||
|
||||
class SalesPointsVolume
|
||||
{
|
||||
|
||||
public static function changeSalesPointsVolumeUser(ShoppingOrder $shoppingOrder, $to_user_id){
|
||||
|
||||
if($shoppingOrder->user_sales_volume){
|
||||
$to_user_id = intval($to_user_id);
|
||||
if($shoppingOrder->user_sales_volume->user_id === $to_user_id){
|
||||
\Session()->flash('alert-error', 'Keine Änderung: selber Berater');
|
||||
return;
|
||||
}
|
||||
if(!$shoppingOrder->user_sales_volume->isCurrentMonthYear()){
|
||||
\Session()->flash('alert-error', 'Änderung muss im selben Monat sein');
|
||||
return;
|
||||
}
|
||||
|
||||
$month = $shoppingOrder->user_sales_volume->month;
|
||||
$year = $shoppingOrder->user_sales_volume->year;
|
||||
$form_user_id = $shoppingOrder->user_sales_volume->user_id;
|
||||
|
||||
$to_user = User::find($to_user_id);
|
||||
$form_user = User::find($form_user_id);
|
||||
|
||||
$shoppingOrder->user_sales_volume->user_id = $to_user_id;
|
||||
$shoppingOrder->user_sales_volume->message = 'Punkte zugewiesen am: '.date('d.m.Y');
|
||||
|
||||
$syslog = $shoppingOrder->user_sales_volume->syslog;
|
||||
$syslog[date('d.m.Y-h:i:s')] = 'change form: #'.$form_user_id.' '.$form_user->email.' to: #'.$to_user_id.' '.$to_user->email;
|
||||
$shoppingOrder->user_sales_volume->syslog = $syslog;
|
||||
|
||||
$shoppingOrder->user_sales_volume->save();
|
||||
|
||||
//recalculate
|
||||
self::reCalculateSalesPointsVolume($to_user_id, $month, $year);
|
||||
self::reCalculateSalesPointsVolume($form_user_id, $month, $year);
|
||||
\Session()->flash('alert-save', true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function reCalculateSalesPointsVolume($user_id, $month, $year){
|
||||
|
||||
$userSalesVolumes = UserSalesVolume::where('user_id', $user_id)->where('month', $month)->where('year', $year)->orderBy('id', 'ASC')->get();
|
||||
$month_points = 0;
|
||||
$month_total_net = 0;
|
||||
$month_shop_points = 0;
|
||||
$month_shop_total_net = 0;
|
||||
//TDOO Status === 3???
|
||||
|
||||
foreach($userSalesVolumes as $userSalesVolume){
|
||||
switch ($userSalesVolume->status) {
|
||||
case 1: //Bestellung
|
||||
$month_points += $userSalesVolume->points;
|
||||
$month_total_net += $userSalesVolume->total_net;
|
||||
break;
|
||||
case 2: //Shop
|
||||
$month_shop_points += $userSalesVolume->points;
|
||||
$month_shop_total_net += $userSalesVolume->total_net;
|
||||
break;
|
||||
}
|
||||
$userSalesVolume->month_shop_points = $month_shop_points;
|
||||
$userSalesVolume->month_shop_total_net = $month_shop_total_net;
|
||||
$userSalesVolume->month_points = $month_points;
|
||||
$userSalesVolume->month_total_net = $month_total_net;
|
||||
$userSalesVolume->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function addSalesPointsVolumeUser(ShoppingOrder $shoppingOrder){
|
||||
|
||||
/*
|
||||
status
|
||||
1 => 'hinzugefügt aus Bestellung',
|
||||
2 => 'hinzugefügt aus Shop',
|
||||
3 => 'hinzugefügt aus Shop / pending',
|
||||
*/
|
||||
$status = self::getStatusByOrderPaymentFor($shoppingOrder);
|
||||
$user_id = $shoppingOrder->auth_user_id ? $shoppingOrder->auth_user_id : $shoppingOrder->member_id;
|
||||
//akuteller tag / Monat.
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$date = date('d.m.Y');
|
||||
|
||||
if($status === 3){ //shop bestellung User pending if is_like
|
||||
$user_id = NULL;//$shoppingOrder->auth_user_id ? $shoppingOrder->auth_user_id : $shoppingOrder->member_id;
|
||||
$month_points = 0;
|
||||
$month_total_net = 0;
|
||||
$month_shop_points = 0;
|
||||
$month_shop_total_net = 0;
|
||||
}else{
|
||||
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
|
||||
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
|
||||
}
|
||||
switch ($status) {
|
||||
case 1: //Bestellung
|
||||
$month_points += $shoppingOrder->points;
|
||||
$month_total_net += $shoppingOrder->subtotal;
|
||||
break;
|
||||
case 2: //Shop
|
||||
$month_shop_points += $shoppingOrder->points;
|
||||
$month_shop_total_net += $shoppingOrder->subtotal;
|
||||
break;
|
||||
}
|
||||
|
||||
return UserSalesVolume::create([
|
||||
'user_id' => $user_id,
|
||||
'shopping_order_id' => $shoppingOrder->id,
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'date' => $date,
|
||||
'points' => $shoppingOrder->points,
|
||||
'month_points' => $month_points,
|
||||
'month_shop_points' => $month_shop_points,
|
||||
'total_net' => $shoppingOrder->subtotal,
|
||||
'month_total_net' => $month_total_net,
|
||||
'month_shop_total_net' => $month_shop_total_net,
|
||||
'message' => '',
|
||||
'status' => $status,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function setToUserAndReCalculate(UserSalesVolume $user_sales_volume, $user_id){
|
||||
|
||||
//set month year date new, calculate it in the currently month!
|
||||
//If the month has changed, it can no longer be added to the month before
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$date = date('d.m.Y');
|
||||
|
||||
$user_sales_volume->user_id = $user_id;
|
||||
$user_sales_volume->month = $month;
|
||||
$user_sales_volume->year = $year;
|
||||
$user_sales_volume->date = $date;
|
||||
$user_sales_volume->status = 2; //hinzugefügt aus Shop can only Pending
|
||||
$user_sales_volume->save();
|
||||
|
||||
self::reCalculateSalesPointsVolume($user_id, $month, $year);
|
||||
}
|
||||
|
||||
public static function getStatusByOrderPaymentFor(ShoppingOrder $shoppingOrder){
|
||||
if($shoppingOrder->payment_for){
|
||||
if($shoppingOrder->payment_for === 6){ //Kunde-Shop
|
||||
if($shoppingOrder->shopping_user && $shoppingOrder->shopping_user->is_like){
|
||||
return 3; //shop Kunden, berater zuordnen <- need?
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ namespace App\Services;
|
|||
use App\Mail\MailCheckout;
|
||||
use App\Mail\MailInfo;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
use App\Services\Shop;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
|
@ -79,7 +80,7 @@ class CustomerPriority
|
|||
}
|
||||
//set Points and Volume
|
||||
if ($shopping_user->shopping_order && $user_sales_volume = $shopping_user->shopping_order->user_sales_volume_no_userid()) {
|
||||
$user_sales_volume->setToUserAndCalculate($shopping_user->member_id);
|
||||
SalesPointsVolume::setToUserAndReCalculate($user_sales_volume, $shopping_user->member_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ class HTMLHelper
|
|||
if($value->account){
|
||||
$to = $value->account->first_name." ".$value->account->last_name." | ";
|
||||
}
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.$value->email.' #'.$value->number.'</option>\n';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$to.$value->email.' #'.$value->account->m_account.'</option>\n';
|
||||
|
||||
}
|
||||
return $ret;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class Payment
|
|||
'paid' => "bezahlt",
|
||||
'appointed' => "offen",
|
||||
'failed' => "abbruch",
|
||||
'extern' => "extern",
|
||||
'extern' => "offen", //offen
|
||||
'extern_paid' => "bezahlt",
|
||||
'invoice_open' => "offen",
|
||||
'invoice_paid' => "bezahlt",
|
||||
'invoice_non' => "keine Zahlung",
|
||||
|
|
@ -34,7 +35,8 @@ class Payment
|
|||
'paid' => "success",
|
||||
'appointed' => "warning",
|
||||
'failed' => "danger",
|
||||
'extern' => "success",
|
||||
'extern' => "warning",
|
||||
'extern_paid' => "success",
|
||||
'invoice_open' => "warning",
|
||||
'invoice_paid' => "success",
|
||||
'invoice_non' => "failed",
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@ class Shop
|
|||
$shopping_users = ShoppingUser::where('number', '=', $number)->get();
|
||||
$orders = 1;
|
||||
foreach ($shopping_users as $shopping_user) {
|
||||
if($shopping_user->shopping_order && ($shopping_user->shopping_order->txaction === 'paid' || $shopping_user->shopping_order->txaction === 'appointed' || $shopping_user->shopping_order->txaction === 'extern')){
|
||||
if($shopping_user->shopping_order && ($shopping_user->shopping_order->txaction === 'paid' ||
|
||||
$shopping_user->shopping_order->txaction === 'appointed' ||
|
||||
$shopping_user->shopping_order->txaction === 'extern' ||
|
||||
$shopping_user->shopping_order->txaction === 'extern_paid' )){
|
||||
$shopping_user->orders = $orders++;
|
||||
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class ShopApiOrderCart
|
|||
//price brutto calu with
|
||||
private function calcuPriceWith($price, $tax_rate = null, $discount = null){
|
||||
$tax_dec = ($tax_rate + 100) / 100;
|
||||
$price / $tax_dec;
|
||||
$price = $price / $tax_dec;
|
||||
$margin = (($discount -100)*-1) / 100;
|
||||
$price = $price * $margin;
|
||||
return round($price, 2);
|
||||
|
|
@ -199,6 +199,7 @@ class ShopApiOrderCart
|
|||
$api_notice = $ShoppingOrder->api_notice;
|
||||
$api_notice['shopping_order_id'] = $shoppingCollectOrder->shopping_order_id;
|
||||
$ShoppingOrder->api_notice = $api_notice;
|
||||
$ShoppingOrder->txaction = 'extern_paid';
|
||||
$ShoppingOrder->save();
|
||||
}
|
||||
$shoppingCollectOrder->status = 2; //order
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use App\Models\ShoppingOrder;
|
|||
use App\Models\UserSalesVolume;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Repositories\ImportRepository;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
|
||||
class Correction
|
||||
{
|
||||
|
|
@ -23,7 +24,7 @@ class Correction
|
|||
3 => 'hinzugefügt aus Shop / pending',
|
||||
|
||||
*/
|
||||
$status = UserSalesVolume::getStatusByOrder($order);
|
||||
$status = SalesPointsVolume::getStatusByOrderPaymentFor($order);
|
||||
$user_id = $order->auth_user_id ? $order->auth_user_id : $order->member_id;
|
||||
//akuteller tag / Monat.
|
||||
$month = $order->created_at->format('m');
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class CreateUserSalesVolumesTable extends Migration
|
|||
$table->string('message', 255)->nullable();
|
||||
$table->unsignedTinyInteger('status')->index()->default(0);
|
||||
|
||||
$table->text('syslog')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ var IqHomepartyCart = {
|
|||
if(number < 1 || isNaN(number)){
|
||||
return 1;
|
||||
}
|
||||
if(number >= 100){
|
||||
return 100;
|
||||
if(number >= 999){
|
||||
return 999;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ var IqShoppingCart = {
|
|||
if(number < 0 || isNaN(number)){
|
||||
return 0;
|
||||
}
|
||||
if(number >= 100){
|
||||
return 100;
|
||||
if(number >= 999){
|
||||
return 999;
|
||||
}
|
||||
return number;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ return [
|
|||
'payments' => 'Finanzen',
|
||||
'invoice' => 'Rechnungen',
|
||||
'credit' => 'Gutschriften',
|
||||
'points' => 'Points',
|
||||
'system_settings' => 'System-E.',
|
||||
'business' => 'Business',
|
||||
'structure' => 'Struktur',
|
||||
|
|
|
|||
83
resources/views/admin/modal/change_points.blade.php
Normal file
83
resources/views/admin/modal/change_points.blade.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{!! Form::open(['url' => $route, 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
{{ __('Points / Umsatz') }}
|
||||
<span class="font-weight-light">zuweisen/ändern</span>
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="action" value="{{ $data['action'] }}">
|
||||
<input type="hidden" name="id" value="{{ $data['id'] }}">
|
||||
<input type="hidden" name="view" value="{{ $data['view'] }}">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="change_member_key" class="form-label">{{ __('Passwort eingeben') }}*</label>
|
||||
<input type="text" class="form-control" name="change_member_key" id="change_member_key"
|
||||
placeholder="mivita" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label for="change_member_id" class="form-label">{{ __('Berater zuweisen') }}*</label>
|
||||
<select class="selectpicker" name="change_member_id" id="change_member_id" data-style="btn-light"
|
||||
data-live-search="true" required>
|
||||
{!! HTMLHelper::getMembersOptions($value->member_id, true) !!}
|
||||
</select>
|
||||
<p class="text-muted">Es werden nur aktive Berater mit aktiven Accounts angezeigt.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Points</th>
|
||||
<th>Umsatz netto</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($value->user_sales_volume)
|
||||
<tr>
|
||||
<td>{{ $value->user_sales_volume->date }}</td>
|
||||
<td>{{ $value->user_sales_volume->points }}</td>
|
||||
<td>{{ formatNumber($value->user_sales_volume->total_net) }} €</td>
|
||||
<td>{{ $value->user_sales_volume->getStatusType() }}</td>
|
||||
</tr>
|
||||
@if($value->user_sales_volume->message)
|
||||
<tr>
|
||||
<td colspan="4">{{ $value->user_sales_volume->message }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@if($value->user_sales_volume->isCurrentMonthYear())
|
||||
<label class="custom-control custom-checkbox">
|
||||
{!! Form::checkbox('change_points', 1, 0, ['class' => 'custom-control-input', 'id' => 'change_points', 'required'=>true]) !!}
|
||||
<span class="custom-control-label">Points / Umsatz einen neuen Berater zuweisen</span>
|
||||
</label>
|
||||
@else
|
||||
Points können nicht mehr verschoben werden.
|
||||
@endif
|
||||
<hr>
|
||||
<i>Points können nur innerhalb des akutellen Monats verschoben werden, da sonst die monatliche Auswertung schon berechnet ist.
|
||||
Danach können Points für den akutellen Monat manuell gutgeschrieben werden.</i><br>
|
||||
<a class="btn btn-sm btn-default mt-2" href="{{ route('admin_business_points') }}">Business -> Points gutschreiben</a>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
|
||||
<button type="submit" class="btn btn-primary">{{ __('übernehmen') }}</button>
|
||||
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -11,18 +11,20 @@
|
|||
<div class="col-md-3 mb-1">
|
||||
<strong class="mr-2">Versand:</strong>
|
||||
|
||||
@if ($isAdmin)
|
||||
<button type="button" class="btn btn-sm btn-{{ $shopping_order->getShippedColor() }}"
|
||||
data-toggle="modal" data-target="#modals-shipped" data-id="{{ $shopping_order->id }}"
|
||||
data-shipped="{{ $shopping_order->shipped }}" data-back="{{ url()->current() }}"
|
||||
data-action="store_shipped">
|
||||
<span class="far fa-edit"></span> <strong>{{ $shopping_order->getShippedType() }}</strong>
|
||||
</button>
|
||||
@else
|
||||
<span class="text-big">
|
||||
<span
|
||||
class="badge badge-pill badge-{{ $shopping_order->getShippedColor() }}">{{ $shopping_order->getShippedType() }}</span>
|
||||
</span>
|
||||
@if($shopping_order->payment_for !== 8)
|
||||
@if ($isAdmin)
|
||||
<button type="button" class="btn btn-sm btn-{{ $shopping_order->getShippedColor() }}"
|
||||
data-toggle="modal" data-target="#modals-shipped" data-id="{{ $shopping_order->id }}"
|
||||
data-shipped="{{ $shopping_order->shipped }}" data-back="{{ url()->current() }}"
|
||||
data-action="store_shipped">
|
||||
<span class="far fa-edit"></span> <strong>{{ $shopping_order->getShippedType() }}</strong>
|
||||
</button>
|
||||
@else
|
||||
<span class="text-big">
|
||||
<span
|
||||
class="badge badge-pill badge-{{ $shopping_order->getShippedColor() }}">{{ $shopping_order->getShippedType() }}</span>
|
||||
</span>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-3 mb-1">
|
||||
|
|
@ -59,7 +61,7 @@
|
|||
target="_blank" class="btn btn-warning btn-sm"><i class="fa fa-eye"></i></a>
|
||||
@endif
|
||||
@endif
|
||||
@if ($shopping_order->txaction === 'extern' && $shopping_order->wp_invoice_path)
|
||||
@if (($shopping_order->txaction === 'extern' || $shopping_order->txaction === 'extern_paid') && $shopping_order->wp_invoice_path)
|
||||
<a href="{{ $shopping_order->wp_invoice_path }}" class="btn btn-secondary btn-sm"><i
|
||||
class="fa fa-external-link-alt"></i> <i class="fa fa-download"></i></a>
|
||||
@endif
|
||||
|
|
@ -104,7 +106,25 @@
|
|||
</div>
|
||||
</div>
|
||||
<hr class="m-0">
|
||||
<!-- / Info -->
|
||||
|
||||
<div class="card-body pb-1">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="text-muted small">Punkte / Umsatz zugewiesen</div>
|
||||
@if($shopping_order->user_sales_volume && $shopping_order->user_sales_volume->user)
|
||||
{{ $shopping_order->user_sales_volume->user->getFullName() }}
|
||||
@endif
|
||||
@if ($isAdmin)
|
||||
<button type="button" class="btn btn-xs btn-outline-secondary" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="{{ $shopping_order->id }}"
|
||||
data-action="shopping-order-change-points" data-view="{{ $isView }}"
|
||||
data-route="{{ route('modal_load') }}"><span class="fa fa-edit"></span></button>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="m-0">
|
||||
|
||||
@if ($isAdmin)
|
||||
<!-- Member -->
|
||||
|
|
@ -343,7 +363,7 @@
|
|||
<hr>
|
||||
@endif
|
||||
@if ($shopping_order->shopping_user->is_from === 'collection')
|
||||
<h5>Berater Sammelbestellung</h5>
|
||||
<h5>Berater Sammelrechnung</h5>
|
||||
<hr>
|
||||
@endif
|
||||
</h6>
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<h5 class="mt-4">Sammelbestellung behinhaltet folgende Kundenbestellungen</h5>
|
||||
<h5 class="mt-4">Sammelrechnung behinhaltet folgende Kundenbestellungen</h5>
|
||||
|
||||
<div class="card-datatable table-responsive pt-0">
|
||||
<table class="table table-striped table-bordered">
|
||||
|
|
|
|||
|
|
@ -172,13 +172,16 @@
|
|||
@if($shopping_order->shopping_user->is_from === 'extern')
|
||||
<b>{{__('email.checkout_mail_order_for_extern')}}</b>
|
||||
@endif
|
||||
@if($shopping_order->shopping_user->is_from === 'collection')
|
||||
<b>Berater Sammelrechnung</b><br>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@if($shopping_order->shopping_user->is_from === 'homeparty')
|
||||
@include('emails.homeparty_detail')
|
||||
@elseif($shopping_order->shopping_collect_order)
|
||||
@elseif($shopping_order->shopping_user->is_from === 'collection' && $shopping_order->shopping_collect_order)
|
||||
@include('emails.collection_detail')
|
||||
@else
|
||||
@include('emails.shopping_order_detail')
|
||||
|
|
|
|||
|
|
@ -215,14 +215,20 @@
|
|||
<b>{{ __('navigation.my_homeparty') }} / {{ $shopping_order->homeparty->name }} - {{ $shopping_order->homeparty->date }}</b><br>
|
||||
<b>{{__('email.checkout_mail_hl1')}}</b>
|
||||
@endif
|
||||
@if($shopping_order->shopping_user->is_from === 'extern')
|
||||
<b>{{__('email.checkout_mail_order_for_extern')}}</b>
|
||||
@endif
|
||||
@if($shopping_order->shopping_user->is_from === 'collection')
|
||||
<b>Berater Sammelrechnung</b><br>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@if($shopping_order->shopping_user->is_from === 'homeparty')
|
||||
@include('emails.homeparty_detail')
|
||||
@elseif($shopping_order->shopping_collect_order)
|
||||
@include('emails.collection_detail')
|
||||
@elseif($shopping_order->shopping_user->is_from === 'collection' && $shopping_order->shopping_collect_order)
|
||||
@include('emails.collection_detail')
|
||||
@else
|
||||
@include('emails.shopping_order_detail')
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@
|
|||
<div>{{ __('navigation.payments') }}</div>
|
||||
</a>
|
||||
<ul class="sidenav-menu">
|
||||
|
||||
<li class="sidenav-item{{ Request::is('admin/payments/invoice') ? ' active' : '' }}">
|
||||
<a href="{{ route('admin_payments_invoice') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropleft-circle"></i><div>{{ __('navigation.invoice') }}</div></a>
|
||||
</li>
|
||||
|
|
@ -165,6 +166,9 @@
|
|||
<li class="sidenav-item{{ Request::is('admin/business/structure', 'admin/business/structure/*') ? ' active' : '' }}">
|
||||
<a href="{{ route('admin_business_structure') }}" class="sidenav-link"><i class="sidenav-icon ion ion ion-md-funnel rotate-180" style="text-align: right"></i><div>{{ __('navigation.structure') }}</div></a>
|
||||
</li>
|
||||
<li class="sidenav-item{{ Request::is('admin/business/points') ? ' active' : '' }}">
|
||||
<a href="{{ route('admin_business_points') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropup-circle"></i><div>{{ __('navigation.points') }}</div></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
</style>
|
||||
<div id="invoice_journal_box">
|
||||
<h4>Sammelbestellung behinhaltet folgende Kundenbestellungen</h4>
|
||||
<h4>Sammelrechnung behinhaltet folgende Kundenbestellungen</h4>
|
||||
@if($shopping_order->shopping_collect_order)
|
||||
@foreach($shopping_order->shopping_collect_order->orders as $order)
|
||||
@php($order = $shopping_order->shopping_collect_order->initShoppingOrder($order))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
@section('content')
|
||||
<h4 class="font-weight-bold py-2 mb-2">
|
||||
<a href="{{route('user_orders')}}" class="btn btn-sm btn-default float-right">zurück</a>
|
||||
{{ __('Bestellung Kunde') }} <span class="text-muted">#{{$shopping_order->id}}</span>
|
||||
{{ __('Bestellung Berater') }} <span class="text-muted">#{{$shopping_order->id}}</span>
|
||||
</h4>
|
||||
@include('admin.sales._detail')
|
||||
<a href="{{route('user_orders')}}" class="btn btn-sm btn-default mt-2 float-right">zurück</a>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
<h4 class="font-weight-bold py-2 mb-2 d-flex justify-content-between align-items-center w-100 ">
|
||||
<div>{{ __('Externe Bestellungen') }} | bestellen</div>
|
||||
<div>{{ __('Externe Bestellungen') }} | Sammelrechnung</div>
|
||||
<a href="{{route('user_shop_api_orders')}}" class="btn btn-sm btn-default float-right">zurück</a>
|
||||
</h4>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
</div>
|
||||
<div class="col-12 mb-0 mt-1">
|
||||
<p class="mb-0">
|
||||
bestellen = Sammelbestellung aufgeben<br>
|
||||
bezahlen = Sammelrechnung erstellen und zum Checkout<br>
|
||||
entfernen = Bestellungen werden nach entfernt verschoben, für Stornos etc.<br>
|
||||
zurücksetzen = Bestellungen werden nur nach offen verschoben, Sammelbestellung werden nicht geändert
|
||||
zurücksetzen = Bestellungen werden nur nach offen verschoben, Sammelrechnung werden nicht geändert
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{{__('Status') }}</th>
|
||||
<th>{{__('Zahlung') }}</th>
|
||||
<th>{{__('Versand') }}</th>
|
||||
<th>{{__('First name')}}</th>
|
||||
<th>{{__('Last name')}}</th>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
{{ __('Bestellung') }} <span class="text-muted">#{{$shopping_order->id}}</span>
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5 class="mt-4">Sammelrechnung behinhaltet folgende Kundenbestellungen</h5>
|
||||
|
||||
<div class="card-datatable table-responsive pt-0">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{{__('Nummer') }}</th>
|
||||
<th>{{__('Versand') }}</th>
|
||||
<th>{{__('First name')}}</th>
|
||||
<th>{{__('Last name')}}</th>
|
||||
<th>{{__('E-Mail')}}</th>
|
||||
<th>{{__('Datum')}}</th>
|
||||
<th>{{__('Betrag')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($shopping_order->shopping_collect_order->orders as $order)
|
||||
@php($order = $shopping_order->shopping_collect_order->initShoppingOrder($order))
|
||||
<tr>
|
||||
<td><button type="button" class="btn icon-btn btn-sm btn-secondary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="{{ $order['order_id'] }}"
|
||||
data-action="shop-user-order-detail"
|
||||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="admin"
|
||||
data-route="{{ route('modal_load') }}"><span class="far fa-eye"></span></button>
|
||||
</td>
|
||||
<td>{{ $order['order_id'] }}</td>
|
||||
<td>
|
||||
<span class="badge badge-pill badge-{{ $order['shopping_order']->getShippedColor() }}">{{ $order['shopping_order']->getShippedType() }}</span>
|
||||
</td>
|
||||
<td>{{ $order['shopping_order']->shopping_user->billing_firstname }}</td>
|
||||
<td>{{ $order['shopping_order']->shopping_user->billing_lastname }}</td>
|
||||
<td>{{ $order['shopping_order']->shopping_user->billing_email }}</td>
|
||||
<td>{{ $order['shopping_order']->created_at->format("d.m.Y") }}</td>
|
||||
<td>{{ $order['shopping_order']->getFormattedTotalShipping() }} €</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
@ -15,13 +15,14 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{{__('Datum')}}</th>
|
||||
<th>{{__('Betrag')}}</th>
|
||||
<th>{{__('Status')}}</th>
|
||||
<th>{{__('Versand')}}</th>
|
||||
|
||||
<th>{{__('First name')}}</th>
|
||||
<th>{{__('Last name')}}</th>
|
||||
<th>{{__('E-Mail')}}</th>
|
||||
<th>{{__('Datum')}}</th>
|
||||
<th>{{__('Status')}}</th>
|
||||
<th>{{__('Betrag')}}</th>
|
||||
<th>{{__('Versand')}}</th>
|
||||
<th>{{__('Rechnung')}}</th>
|
||||
|
||||
<th>{{__('Art')}}</th>
|
||||
|
|
@ -39,13 +40,13 @@
|
|||
"order": [[0, "desc" ]],
|
||||
"columns": [
|
||||
{ data: 'id', searchable: false },
|
||||
{ data: 'created_at', name: 'created_at' },
|
||||
{ data: 'total_shipping', name: 'total_shipping' },
|
||||
{ data: 'txaction', name: 'txaction' },
|
||||
{ data: 'shipped', name: 'shipped' },
|
||||
{ data: 'shopping_user.billing_firstname', name: 'shopping_user.billing_firstname' },
|
||||
{ data: 'shopping_user.billing_lastname', name: 'shopping_user.billing_lastname' },
|
||||
{ data: 'shopping_user.billing_email', name: 'shopping_user.billing_email' },
|
||||
{ data: 'created_at', name: 'created_at' },
|
||||
{ data: 'txaction', name: 'txaction' },
|
||||
{ data: 'total_shipping', name: 'total_shipping' },
|
||||
{ data: 'shipped', name: 'shipped' },
|
||||
{ data: 'invoice', name: 'invoice', orderable: false },
|
||||
{ data: 'payment_for', name: 'payment_for' },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -972,7 +972,7 @@
|
|||
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-lg btn-block size-18 btn-text-500 mt-4 faa-parent animated-hover"><i class="fa fa-mail-forward faa-horizontal"></i> Jetzt kaufen</button>
|
||||
<hr><p class="text-center" style="line-height: 1.2em;"><em class="small text-center"> <i class="fa fa-lock"></i> 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.</em></p>
|
||||
<hr><p class="text-center" style="line-height: 1.2em;"><em class="small text-center"> <i class="fa fa-lock"></i> Sind alle Deine Angaben vollständig ausgefüllt, klicke auf "Jetzt kaufen" und Du wirst zu unserem Zahlungsanbieter weitergeleitet, die Verbindung ist SSL verschlüsselt.</em></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
|
|||
Route::post('/admin/payments/invoice', 'PaymentInvoiceController@index')->name('admin_payments_invoice');
|
||||
Route::get('/admin/payments/invoice/datatable', 'PaymentInvoiceController@datatable')->name('admin_payments_invoice_datatable');
|
||||
|
||||
|
||||
//payments credit // Gutschriften
|
||||
Route::get('/admin/payments/credit', 'PaymentCreditController@index')->name('admin_payments_credit');
|
||||
Route::post('/admin/payments/credit', 'PaymentCreditController@store')->name('admin_payments_credit');
|
||||
|
|
@ -408,6 +409,11 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
|
|||
|
||||
Route::get('/admin/business/user/datatable', 'BusinessController@userDatatable')->name('admin_business_user_datatable');
|
||||
|
||||
//payments points // Gutschreiben
|
||||
Route::get('/admin/business/points', 'BusinessPointsController@index')->name('admin_business_points');
|
||||
Route::post('/admin/business/points', 'BusinessPointsController@index')->name('admin_business_points');
|
||||
Route::get('/admin/business/points/datatable', 'BusinessPointsController@datatable')->name('admin_business_points_datatable');
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue