diff --git a/.gitignore b/.gitignore
index 1ea1168c..1940d3a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,18 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
+.idea/
+.claude/
+.cursor/
+.cursorrules/
+.cursorrules.md/
+.cursorrules.md.txt/
+.cursorrules.md.txt.txt/
+.cursorrules.md.txt.txt.txt/
+
+_static/
+_work/
+_storage/
/vendor
/node_modules
@@ -32,4 +44,4 @@ Temporary Items
/storage/framework
/storage/logs
/public/vendor
-/storage/app
+/storage/app
\ No newline at end of file
diff --git a/app/Domain/DomainContext.php b/app/Domain/DomainContext.php
new file mode 100644
index 00000000..ae3bccc0
--- /dev/null
+++ b/app/Domain/DomainContext.php
@@ -0,0 +1,69 @@
+type === 'unknown';
+ }
+
+ /**
+ * Prüft, ob es sich um eine User-Shop-Domain handelt.
+ */
+ public function isUserShop(): bool
+ {
+ return $this->type === 'user-shop';
+ }
+
+ /**
+ * Gibt den Slug des User-Shops zurück.
+ */
+ public function getUserShopSlug(): ?string
+ {
+ return $this->userShop?->slug;
+ }
+
+
+}
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 3586c3f6..b00396b3 100755
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -61,6 +61,35 @@ class Handler extends ExceptionHandler
return parent::render($request, $exception);
}
+ /**
+ * Convert an authentication exception into a response.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Illuminate\Auth\AuthenticationException $exception
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ protected function unauthenticated($request, \Illuminate\Auth\AuthenticationException $exception)
+ {
+ if ($request->expectsJson()) {
+ return response()->json(['message' => $exception->getMessage()], 401);
+ }
+
+ try {
+ // Versuche domain-spezifische Login-Route
+ $context = app(\App\Domain\DomainContext::class);
+ $loginRoute = match($context->type) {
+ 'portal' => 'portal.login.form',
+ 'crm' => 'login', // CRM hat eine eigene login route
+ default => 'login'
+ };
+
+ return redirect()->guest(route($loginRoute));
+ } catch (\Exception $e) {
+ // Fallback: Weiterleitung zur Hauptdomain
+ return redirect()->guest('https://' . config('app.domain') . config('app.tld_care') . '/login');
+ }
+ }
+
public function sendEmail(Throwable $exception)
{
try {
@@ -69,14 +98,25 @@ class Handler extends ExceptionHandler
$css = $handler->getStylesheet();
$content = $handler->getBody($e);
//Mail::to(config('app.exception_mail'))->send(new MailContact($contact));
- \Mail::send('emails.exception', compact('css','content'), function ($message) {
- $message
- ->to(config('app.exception_mail'))
- ->subject('mivita Exception: ' . \Request::fullUrl())
- ;
- });
+ // Verwende normale Mail-Klasse statt Facade, um Probleme bei der Initialisierung zu vermeiden
+ $to = config('app.exception_mail');
+ $subject = 'mivita Exception: ' . \Request::fullUrl();
+
+ if ($to) {
+ \Mail::send('emails.exception', compact('css', 'content'), function ($message) use ($to, $subject) {
+ $message
+ ->to($to)
+ ->subject($subject)
+ ;
+ });
+ }
} catch (Throwable $ex) {
- Log::error($ex);
+ // Einfache Fehlerprotokollierung ohne Facade
+ file_put_contents(
+ storage_path('logs/laravel-' . date('Y-m-d') . '.log'),
+ '[' . date('Y-m-d H:i:s') . '] exception-handler-error: ' . $ex->getMessage() . "\n",
+ FILE_APPEND
+ );
}
}
}
diff --git a/app/Http/Controllers/Admin/ProductsSalesController.php b/app/Http/Controllers/Admin/ProductsSalesController.php
new file mode 100644
index 00000000..3f7c724b
--- /dev/null
+++ b/app/Http/Controllers/Admin/ProductsSalesController.php
@@ -0,0 +1,342 @@
+middleware('admin');
+ }
+
+ public function index()
+ {
+
+ $this->setFilterVars();
+ $data = [
+ 'filter_months' => HTMLHelper::getTransMonths(),
+ 'filter_years' => HTMLHelper::getYearRange(2022),
+ ];
+ return view('admin.payment.salesvolume', $data);
+ }
+
+
+
+ public function download(){
+
+ /*
+ EXCEL EXPORT function */
+
+ if(Request::get('action') === "exportfull_paid"){
+ return $this->exportFullList(1);
+ }
+ if(Request::get('action') === "exportfull_unpaid"){
+ return $this->exportFullList(0);
+ }
+
+ if(Request::get('action') === "exportfull_paid_invoice"){
+ return $this->exportFullListInvoice();
+ }
+
+
+
+ if(Request::get('action') === "export"){
+ $objects = $this->initSearch(false);
+ $columns = [];
+ $filename = "mivita-absatzmengen-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
+ $headers = array(
+ '#',
+ 'Produkt',
+ 'Artikelnummer',
+ 'Menge',
+
+ );
+ if($objects){
+ foreach ($objects as $key => $obj){
+ $columns[] = array(
+ 'id' => $key,
+ 'name' => $obj['name'],
+ 'number' => $obj['number'],
+ 'value' => $obj['value'],
+ );
+ }
+ }
+ return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
+ }
+ }
+
+
+ private function setFilterVars(){
+
+ if(!session('product_sales_vol_filter_month')){
+ session(['product_sales_vol_filter_month' => intval(date('m'))]);
+ }
+ if(!session('product_sales_vol_filter_year')){
+ session(['product_sales_vol_filter_year' => intval(date('Y'))]);
+ }
+
+ if(Request::get('product_sales_vol_filter_month')){
+ session(['product_sales_vol_filter_month' => Request::get('product_sales_vol_filter_month')]);
+ }
+ if(Request::get('product_sales_vol_filter_year')){
+ session(['product_sales_vol_filter_year' => Request::get('product_sales_vol_filter_year')]);
+ }
+ }
+
+ public function exportFullList($paid = 1){
+
+ $date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d H:i:s');
+ $date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d H:i:s');
+ $ShoppingOrders = ShoppingOrder::where('paid', $paid)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
+
+ $txActions = ['prev' => 'keine Zahlung', 'appointed' => 'offen', 'failed' => 'abbruch', 'paid' => 'bezahlt'];
+ $headers = array('ID', 'Zahlung', 'Datum', 'EMail', 'ProduktID', 'ProduktNummer', 'ProduktName', 'Anzahl', 'Notiz', 'Gesamt');
+ $objects = [];
+ $columns = [];
+ $hasSOID = [];
+ foreach($ShoppingOrders as $ShoppingOrder){
+ foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
+ $value = "";
+ if($shopping_order_item->product){
+ if(isset($objects[$shopping_order_item->product->id])){
+ $value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
+ $objects[$shopping_order_item->product->id]['value'] = $value;
+ }else{
+ $objects[$shopping_order_item->product->id] = [
+ 'name' => $shopping_order_item->product->name,
+ 'number' => $shopping_order_item->product->number,
+ 'value' => $shopping_order_item->qty
+ ];
+ $value = $shopping_order_item->qty;
+
+ }
+
+ }
+ $object = [];
+ if(in_array($ShoppingOrder->id, $hasSOID)){
+ $object['ID'] = '';
+ $object['EMail'] = '';
+ $object['Zahlung'] = '';
+ $object['Datum'] = '';
+ }else{
+ $object['ID'] = $ShoppingOrder->id;
+ $object['EMail'] = $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->billing_email : 'n/a';
+ $object['Zahlung'] = isset($txActions[$ShoppingOrder->txaction]) ? $txActions[$ShoppingOrder->txaction] : $ShoppingOrder->txaction;
+ $object['Datum'] = $ShoppingOrder->created_at->format('d.m.Y');
+ }
+ $object['ProduktID'] = $shopping_order_item->product_id;
+ $object['ProduktNummer'] = $shopping_order_item->product ? $shopping_order_item->product->number : "n/a";
+ $object['ProduktName'] = $shopping_order_item->product ? $shopping_order_item->product->name : "n/a";
+ $object['Anzahl'] = $shopping_order_item->qty;
+ $object['Notiz'] = ($shopping_order_item->comp ? 'Compensation '.$shopping_order_item->comp : '') . ($shopping_order_item->shopping_collect_order_id ? 'Sammelbestellung '.$shopping_order_item->shopping_collect_order_id : '');
+ $object['Gesamt'] = $value;
+ $columns[] = $object;
+
+ $hasSOID[] = $ShoppingOrder->id;
+ }
+ }
+ if($paid){
+ $filename = "mivita-absatzmengen-full-paid-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
+ }else{
+ $filename = "mivita-absatzmengen-full-unpaid-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
+ }
+
+ return Excel::download(new xExport($columns, $headers), $filename.'.xls');
+
+ /* CSV EXPORT function
+ $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"
+ );
+
+ $header = array('ID', 'Zahlung', 'Datum', 'EMail', 'ProduktID', 'ProduktNummer', 'ProduktName', 'Anzahl', 'Notiz', 'Gesamt');
+
+ $callback = function() use($columns, $header) {
+
+ $file = fopen('php://output', 'w');
+ fputcsv($file, $header);
+ $row = [];
+
+ foreach ($columns as $row) {
+ fputcsv($file, $row);
+
+ }
+
+ fclose($file);
+ };
+
+ return response()->stream($callback, 200, $headers);
+
+ */
+
+ }
+
+ private function initSearch($returnColl = true)
+ {
+ $this->setFilterVars();
+
+ $date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d H:i:s');
+ $date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d H:i:s');
+ $ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
+
+ $objects = [];
+ foreach($ShoppingOrders as $ShoppingOrder){
+ foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
+ if($shopping_order_item->product){
+ if(isset($objects[$shopping_order_item->product->id])){
+ $value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
+ $objects[$shopping_order_item->product->id]['value'] = $value;
+ }else{
+ $objects[$shopping_order_item->product->id] = [
+ 'name' => $shopping_order_item->product->name,
+ 'number' => $shopping_order_item->product->number,
+ 'value' => $shopping_order_item->qty
+ ];
+ }
+ }
+ }
+ }
+
+ if($returnColl){
+ $collection = collect();
+
+ foreach($objects as $key => $obj){
+ $collection->push([
+ 'id' => $key,
+ 'name' => $obj['name'],
+ 'number' => $obj['number'],
+ 'value' => $obj['value'],
+ ]);
+ }
+ return $collection;
+ }
+ return $objects;
+ }
+
+
+ public function datatable(){
+
+ $collection = $this->initSearch(true);
+
+ $collect = collect([
+ ['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
+ ['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
+ ['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
+ ]);
+
+ return \DataTables::of($collection)->toJson();
+
+
+
+ }
+
+ /*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 testCheckFunction(){
+
+ //$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d');
+ //$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
+
+ $date_start = Carbon::parse('01.01.2024')->format('Y-m-d H:i:s');
+ $date_end = Carbon::parse('01.01.2024')->endOfMonth()->format('Y-m-d H:i:s');
+ dump($date_start);
+ dump($date_end);
+
+ $ShoppingOrders = ShoppingOrder::where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
+
+ $objects = [];
+ $counter = 0;
+ foreach($ShoppingOrders as $ShoppingOrder){
+ foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
+
+ if($shopping_order_item->product){
+ if($shopping_order_item->product->id === 122){
+ //dump($shopping_order_item->qty);
+ //$counter += $shopping_order_item->qty;
+ if(isset($objects[$shopping_order_item->product->id])){
+ $value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
+ $objects[$shopping_order_item->product->id]['value'] = $value;
+ }else{
+ $objects[$shopping_order_item->product->id] = [
+ 'name' => $shopping_order_item->product->name,
+ 'number' => $shopping_order_item->product->number,
+ 'value' => $shopping_order_item->qty
+ ];
+ }
+ }
+ }
+
+ }
+ }
+
+ $ShoppingOrderItems = ShoppingOrderItem::whereProductId(122)->whereBetween('created_at', [$date_start, $date_end])->get();
+ $counter = 0;
+ foreach($ShoppingOrderItems as $ShoppingOrderItem){
+ $counter += $ShoppingOrderItem->qty;
+ dump($ShoppingOrderItem->id);
+ }
+ // dump($objects);
+ dump($counter);
+ dd("OKAY");
+ }*/
+
+
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/AdminUserController.php b/app/Http/Controllers/AdminUserController.php
index ff1d882d..f5ae0cea 100755
--- a/app/Http/Controllers/AdminUserController.php
+++ b/app/Http/Controllers/AdminUserController.php
@@ -65,11 +65,11 @@ class AdminUserController extends Controller
$data = Request::all();
$user = User::findOrFail($data['id']);
- if(isset($data['user-delete'])){
+ /* if(isset($data['user-delete'])){
if(isset($data['realy_delete_user'])){
return redirect(route('admin_user_delete', [$user->id]));
}
- }
+ }*/
if(isset($data['save-admin'])){
$user->admin = $data['admin'];
SysLog::action('save-admin', 'admin_user', 3)
@@ -187,12 +187,19 @@ class AdminUserController extends Controller
return redirect('/admin/users');
}
- public function deleteUser($user_id)
+ public function deleteUser()
{
- $user = User::findOrFail($user_id);
- $this->userRepo->deleteUser($user);
-
- \Session()->flash('alert-success', __('msg.contact_delete'));
+ $data = Request::all();
+ $user = User::withTrashed()->findOrFail($data['id']);
+ if(isset($data['realy_delete_user'])){
+ $this->userRepo->deleteUser($user);
+ \Session()->flash('alert-success', __('msg.contact_delete'));
+ }
+ if(isset($data['realy_delete_user_complete'])){
+ // $this->userRepo->deleteUserComplete($user);
+ $this->userRepo->deleteUser($user, true);
+ \Session()->flash('alert-success', __('msg.contact_delete'));
+ }
return redirect('/admin/users');
}
@@ -208,12 +215,28 @@ class AdminUserController extends Controller
public function getUsers()
{
- $query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 5);
+ $query = User::withTrashed()
+ ->where(function($q) {
+ $q->where('pre_deleted_at', '!=', null)
+ ->orWhere(function($query) {
+ $query->whereNull('deleted_at')
+ ->whereNull('pre_deleted_at');
+ });
+ })
+ ->with('account')
+ ->select('users.*')
+ ->where('users.admin', "<", 5);
return \DataTables::eloquent($query)
->addColumn('first_name', function (User $user) {
return $user->account ? $user->account->first_name : '';
})
+ ->addColumn('email', function (User $user) {
+ if($user->pre_deleted_at){
+ return ''.$user->email.'';
+ }
+ return $user->email;
+ })
->addColumn('last_name', function (User $user) {
return $user->account ? $user->account->last_name : '';
})
@@ -288,11 +311,12 @@ class AdminUserController extends Controller
})
->orderColumn('id', 'id $1')
+ ->orderColumn('email', 'email $1')
->orderColumn('confirmed', 'confirmed $1')
->orderColumn('active', 'active $1')
->orderColumn('shop', 'shop $1')
->orderColumn('admin', 'active $1')
- ->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_login', 'action_delete'])
+ ->rawColumns(['id', 'email', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_login', 'action_delete'])
->make(true);
}
}
diff --git a/app/Http/Controllers/Api/GoogleMerchantController.php b/app/Http/Controllers/Api/GoogleMerchantController.php
index c3c32424..e131e575 100644
--- a/app/Http/Controllers/Api/GoogleMerchantController.php
+++ b/app/Http/Controllers/Api/GoogleMerchantController.php
@@ -2,96 +2,60 @@
namespace App\Http\Controllers\Api;
-
use App\Http\Controllers\Controller;
use App\Models\Product as ModelsProduct;
-use Vitalybaev\GoogleMerchant\Feed;
-use Vitalybaev\GoogleMerchant\Product;
-use Vitalybaev\GoogleMerchant\Product\Shipping;
-use Vitalybaev\GoogleMerchant\Product\Availability\Availability;
+use Illuminate\Http\Response;
+use Wearepixel\LaravelGoogleShoppingFeed\LaravelGoogleShoppingFeed;
use App\Services\Util;
class GoogleMerchantController extends Controller
{
+ public function __construct() {}
-
- public function __construct()
+ /**
+ * Generate Google Merchant feed
+ *
+ * @return Response
+ */
+ public function feed()
{
-
- }
-
-
- public function feed(){
-
$products = ModelsProduct::where('active', true)->whereJsonContains('show_on', '1')->orderBy('pos', 'DESC')->get();
+
// Create feed object
- $feed = new Feed("mivita shop", "https://mivita.shop", "Bio Aloe Vera & Naturkosmetuk");
+ $feed = LaravelGoogleShoppingFeed::init(
+ 'mivita shop',
+ 'Bio Aloe Vera & Naturkosmetik',
+ 'https://mivita.shop'
+ );
- // Put products to the feed ($products - some data from database for example)
+ // Put products to the feed
foreach ($products as $product) {
- $item = new Product();
-
- // Set common product properties
- $item->setId($product->id);
- $item->setTitle($product->name);
- $item->setDescription($product->copy);
- $item->setLink($product->getProductUrl());
- $item->setImage($product->getImageUrl());
- $item->setAvailability(Availability::IN_STOCK);
-
- /*if ($product->isAvailable()) {
- $item->setAvailability(Availability::IN_STOCK);
- } else {
- $item->setAvailability(Availability::OUT_OF_STOCK);
- }*/
- $item->setPrice("{$product->price} EUR");
- //$item->setGoogleCategory($product->category_name);
- $item->setBrand('MIVITA');
- $item->setGtin($product->ean);
- $item->setCondition('new');
-
- // Some additional properties
- //$item->setColor($product->color);
- //$item->setSize($product->size);
-
- // Shipping info
- /*
- $shipping = new Shipping();
- $shipping->setCountry('US');
- $shipping->setRegion('CA, NSW, 03');
- $shipping->setPostalCode('94043');
- $shipping->setLocationId('21137');
- $shipping->setService('DHL');
- $shipping->setPrice('1300 USD');
- $item->setShipping($shipping);
- */
-
- // Set a custom shipping label and weight (optional)
- //$item->setShippingLabel('ups-ground');
- //$item->setShippingWeight('2.14');
-
- // Set a custom label (optional)
- $item->setCustomLabel($product->weight, 'product_width');
- $item->setCustomLabel($product->contents_total, 'product_contents_total');
- $item->setCustomLabel($product->getUnitType(), 'product_contents_unit',);
- $item->setCustomLabel($product->contents_str, 'product_contents');
- $item->setCustomLabel($product->ingredients, 'product_ingredients');
-
- $item->setCustomLabel($product->getBasePriceFormattedFullWith(false, false, null), 'product_base_pricing_unit');
-
-
- //$item->setCustomLabel('Some Label 2', 1);
-
- // Add this product to the feed
- $feed->addProduct($item);
+ $feed->addItem([
+ 'id' => $product->id,
+ 'title' => $product->name,
+ 'description' => $product->copy,
+ 'link' => $product->getProductUrl(),
+ 'g:image_link' => $product->getImageUrl(),
+ 'g:availability' => 'in stock',
+ 'g:price' => "{$product->price} EUR",
+ 'g:brand' => 'MIVITA',
+ 'g:gtin' => $product->ean,
+ 'g:condition' => 'new',
+ 'g:custom_label_0' => $product->weight,
+ 'g:custom_label_1' => $product->contents_total,
+ 'g:custom_label_2' => $product->getUnitType(),
+ 'g:custom_label_3' => $product->contents_str,
+ 'g:custom_label_4' => $product->ingredients,
+ 'g:unit_pricing_measure' => $product->getBasePriceFormattedFullWith(false, false, null)
+ ]);
}
-
- // Here we get complete XML of the feed, that we could write to file or send directly
- $feedXml = $feed->build();
- print ($feedXml);
+ return $feed->generate();
+ // Get the feed XML
+ //$feedXml = $feed->toString();
+ //return response($feedXml)->header('Content-Type', 'application/xml');
}
-
- // http://api.mivita.test/google/merchant/feed
-}
\ No newline at end of file
+ // http://api.mivita.test/google/merchant/feed
+
+}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index c9ee721f..c71b8e71 100755
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
@@ -40,12 +41,47 @@ class LoginController extends Controller
$this->middleware('guest')->except('logout');
}
+ public function showLoginForm()
+ {
+ //login als Kunde, dann zum Login wechseln
+ if(Auth::guard('customers')->check()){
+ return redirect()->route('change_login');
+ }
+
+ return view('auth.login');
+ }
+
+ public function showChangeLogin(){
+ if(Auth::guard('customers')->check()){
+ return view('auth.change');
+ }
+ if(Auth::guard('user')->check()){
+ return redirect(route('home'));
+
+ }
+ return redirect(route('login'));
+
+ }
+
+ public function confirmChangeLogin(Request $request)
+ {
+ //$url = Util::getMyMivitaShopUrl();
+ $user_shop_domain = session('user_shop_domain');
+ $locale = session('locale');
+ Auth::guard('customers')->logout();
+ $request->session()->invalidate();
+ $request->session()->regenerateToken();
+ session(['user_shop_domain' => $user_shop_domain]);
+ session(['locale' => $locale]);
+ return redirect()->route('login');
+ }
protected function authenticated(Request $request, $user)
{
$user->last_login = date('Y-m-d H:i:s');
$user->save();
}
+
protected function handleUserWasAuthenticated(Request $request, $throttles)
{
diff --git a/app/Http/Controllers/BusinessControllerOptimized.php b/app/Http/Controllers/BusinessControllerOptimized.php
new file mode 100644
index 00000000..d6343d39
--- /dev/null
+++ b/app/Http/Controllers/BusinessControllerOptimized.php
@@ -0,0 +1,577 @@
+ 'aktiv', 2 => 'nicht aktiv', 3 => 'alle'];
+ private $filter_next_level = [
+ 0 => 'Alle Status',
+ 1 => 'Qualifiziert (grün)',
+ 2 => 'In Arbeit (gelb)',
+ 3 => 'Kein Level (rot)'
+ ];
+ private $month;
+ private $year;
+
+ public function __construct()
+ {
+ $this->middleware('admin');
+ }
+
+ /**
+ * Zeigt die Business-Übersicht (identisch zur Original-Version)
+ */
+ public function show()
+ {
+ $this->setFilterVars();
+
+ $data = [
+ 'filter_months' => HTMLHelper::getTransMonths(),
+ 'filter_years' => HTMLHelper::getYearRange(),
+ 'filter_active' => $this->filter_active,
+ 'filter_levels' => $this->getFilterLevels(),
+ 'filter_next_level' => $this->filter_next_level,
+ 'optimized' => true, // Flag für View um zu zeigen, dass optimierte Version läuft
+ ];
+
+ return view('admin.business_optimized.show', $data);
+ }
+
+ /**
+ * Zeigt die Business-Struktur mit optimierter TreeCalcBot-Version
+ */
+ public function structure()
+ {
+ $startTime = microtime(true);
+ $startMemory = memory_get_usage();
+
+ try {
+ $this->setFilterVars();
+ $this->month = session('business_user_filter_month');
+ $this->year = session('business_user_filter_year');
+
+ Log::info("BusinessControllerOptimized: Building structure for {$this->month}/{$this->year}");
+
+ // Verwende optimierte TreeCalcBot-Version
+ $TreeCalcBot = new TreeCalcBotOptimized($this->month, $this->year, 'admin');
+
+ // Prüfe ob Live-Berechnung für Struktur erzwungen wird
+ $forceLiveCalculation = Request::get('force_live_calculation', false) ||
+ Request::get('force_live_structure', false) ||
+ Request::get('live', false);
+
+ if ($forceLiveCalculation) {
+ Log::info("BusinessControllerOptimized: Force live calculation requested");
+ $TreeCalcBot->initStructureAdmin(true, $forceLiveCalculation); // check=true, forceLiveCalculation=true
+ } else {
+ $TreeCalcBot->initStructureAdmin(); // Standard: verwende gespeicherte wenn verfügbar
+ }
+
+ $endTime = microtime(true);
+ $endMemory = memory_get_usage();
+
+ $executionTime = round(($endTime - $startTime) * 1000, 2);
+ $memoryUsed = $this->formatBytes($endMemory - $startMemory);
+
+ $calculationType = $forceLiveCalculation ? " (LIVE)" : " (CACHE)";
+ Log::info("BusinessControllerOptimized: Structure built in {$executionTime}ms, Memory: {$memoryUsed}{$calculationType}");
+
+ $data = [
+ 'filter_months' => HTMLHelper::getTransMonths(),
+ 'filter_years' => HTMLHelper::getYearRange(),
+ 'TreeCalcBot' => $TreeCalcBot,
+ 'performance' => [
+ 'execution_time' => $executionTime,
+ 'memory_used' => $memoryUsed,
+ 'user_count' => $TreeCalcBot->getTotalUserCount(),
+ 'parentless_count' => $TreeCalcBot->isParentless() ? count($TreeCalcBot->__get('parentless')) : 0,
+ 'calculation_type' => $forceLiveCalculation ? 'Live' : 'Cache'
+ ],
+ 'optimized' => true,
+ 'forceLiveCalculation' => $forceLiveCalculation,
+ ];
+
+ return view('admin.business_optimized.structure', $data);
+
+ } catch (\Exception $e) {
+ Log::error("BusinessControllerOptimized: Error in structure: " . $e->getMessage());
+
+ return view('admin.business_optimized.error', [
+ 'error' => $e->getMessage(),
+ 'month' => $this->month,
+ 'year' => $this->year
+ ]);
+ }
+ }
+
+ /**
+ * Zeigt User-Details mit optimierter Performance
+ */
+ public function userDetail($user_id)
+ {
+ $startTime = microtime(true);
+
+ try {
+ $user = User::with(['account', 'user_level', 'user_sponsor.account'])->findOrFail($user_id);
+ $this->setFilterVars();
+
+ $data = [];
+ $data['month'] = session('business_user_filter_month');
+ $data['year'] = session('business_user_filter_year');
+
+ Log::info("BusinessControllerOptimized: Building user detail for user {$user_id}");
+
+ $TreeCalcBot = new TreeCalcBotOptimized($data['month'], $data['year'], 'admin');
+
+ // Prüfe ob Live-Berechnung über URL-Parameter erzwungen wird
+ $forceLiveCalculation = Request::get('force_live_calculation', false) ||
+ Request::get('force_live', false) ||
+ Request::get('live', false);
+
+ if ($forceLiveCalculation) {
+ Log::info("BusinessControllerOptimized: Force live calculation requested for user {$user_id}");
+ }
+
+ $TreeCalcBot->initBusinesslUserDetail($user, $forceLiveCalculation);
+
+ if (!$TreeCalcBot->__get('business_user')) {
+ Log::warning("BusinessControllerOptimized: No business user found for {$user_id}");
+ abort(403, 'No business user found');
+ }
+
+ $endTime = microtime(true);
+ $executionTime = round(($endTime - $startTime) * 1000, 2);
+
+ $data['performance'] = [
+ 'execution_time' => $executionTime,
+ 'user_id' => $user_id,
+ 'calculation_type' => $forceLiveCalculation ? 'Live' : 'Cache'
+ ];
+
+ $data['forceLiveCalculation'] = $forceLiveCalculation;
+
+ $calculationType = $forceLiveCalculation ? " (LIVE)" : " (CACHE)";
+ Log::info("BusinessControllerOptimized: User detail built in {$executionTime}ms{$calculationType}");
+
+ return view('admin.business_optimized.user_detail', compact('TreeCalcBot', 'user', 'data'));
+
+ } catch (\Exception $e) {
+ Log::error("BusinessControllerOptimized: Error in userDetail for {$user_id}: " . $e->getMessage());
+
+ return view('admin.business_optimized.error', [
+ 'error' => $e->getMessage(),
+ 'user_id' => $user_id
+ ]);
+ }
+ }
+
+ /**
+ * Store-Funktion (identisch zur Original-Version)
+ */
+ public function userStore($user_id)
+ {
+ dd('function on: App\Console\Commands\BusinessStore');
+ }
+
+ /**
+ * Optimierte DataTable für Users mit besserer Performance
+ */
+ public function userDatatable(): JsonResponse
+ {
+ try {
+ $this->month = Request::get('business_user_filter_month');
+ $this->year = Request::get('business_user_filter_year');
+
+ Log::info("BusinessControllerOptimized: Building datatable for {$this->month}/{$this->year}");
+
+ // Prüfe ob optimierte Repository-Daten verfügbar sind
+ if (TreeCalcBotOptimized::isFromStored($this->month, $this->year)) {
+ return $this->userStoredDatatableOptimized();
+ } else {
+ return $this->userCurrentlyDatatableOptimized();
+ }
+
+ } catch (\Exception $e) {
+ Log::error("BusinessControllerOptimized: Error in userDatatable: " . $e->getMessage());
+
+ return response()->json([
+ 'error' => 'Datatable could not be loaded: ' . $e->getMessage()
+ ], 500);
+ }
+ }
+
+ /**
+ * Optimierte Stored-Datatable mit besserer Query-Performance
+ */
+ private function userStoredDatatableOptimized(): JsonResponse
+ {
+ $query = $this->initStoredSearchOptimized();
+
+ return \DataTables::eloquent($query)
+ ->addColumn('id', function (UserBusiness $userBusiness) {
+ return TreeHelperOptimized::generateActionButtons($userBusiness->user_id);
+ })
+ ->addColumn('m_account', function (UserBusiness $userBusiness) {
+ return e($userBusiness->m_account);
+ })
+ ->addColumn('user_level', function (UserBusiness $userBusiness) {
+ return e($userBusiness->user_level_name);
+ })
+ ->addColumn('is_qual_kp', function (UserBusiness $userBusiness) {
+ return TreeHelperOptimized::generateQualKPBadge($userBusiness);
+ })
+ ->addColumn('sales_volume_KP_points', function (UserBusiness $userBusiness) {
+ return TreeHelperOptimized::generateSalesVolumeDisplay($userBusiness, 'points');
+ })
+ ->addColumn('sales_volume_total', function (UserBusiness $userBusiness) {
+ return TreeHelperOptimized::generateSalesVolumeDisplay($userBusiness, 'total');
+ })
+ ->addColumn('email', function (UserBusiness $userBusiness) {
+ return e($userBusiness->email);
+ })
+ ->addColumn('first_name', function (UserBusiness $userBusiness) {
+ return e($userBusiness->first_name);
+ })
+ ->addColumn('last_name', function (UserBusiness $userBusiness) {
+ return e($userBusiness->last_name);
+ })
+ ->addColumn('sponsor', function (UserBusiness $userBusiness) {
+ return TreeHelperOptimized::generateSponsorDisplay($userBusiness);
+ })
+ ->addColumn('active_account', function (UserBusiness $userBusiness) {
+ return get_active_badge($userBusiness->active_account);
+ })
+ ->addColumn('next_level_qualified', function (UserBusiness $userBusiness) {
+ return NextLevelBadgeHelper::generateBadgeFromUserBusiness($userBusiness);
+ })
+ ->addColumn('payment_account_date', function (UserBusiness $userBusiness) {
+ return $userBusiness->active_date ? formatDate($userBusiness->active_date) : "-";
+ })
+ ->filterColumn('m_account', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.m_account LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('first_name', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.first_name LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('last_name', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.last_name LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('email', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.email LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->orderColumn('id', 'id $1')
+ ->orderColumn('m_account', 'm_account $1')
+ ->orderColumn('email', 'email $1')
+ ->orderColumn('first_name', 'first_name $1')
+ ->orderColumn('last_name', 'last_name $1')
+ ->orderColumn('active_account', 'payment_account $1')
+ ->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account', 'next_level_qualified'])
+ ->make(true);
+ }
+
+ /**
+ * Optimierte Currently-Datatable mit Repository Pattern
+ */
+ private function userCurrentlyDatatableOptimized(): JsonResponse
+ {
+ $repository = new BusinessUserRepository($this->month, $this->year);
+
+ // Nutze Repository für optimierte Abfragen
+ $query = $this->initCurrentlySearchOptimized();
+
+ return \DataTables::eloquent($query)
+ ->addColumn('id', function (User $user) {
+ return TreeHelperOptimized::generateActionButtons($user->id);
+ })
+ ->addColumn('m_account', function (User $user) {
+ return $user->account ? e($user->account->m_account) : '';
+ })
+ ->addColumn('user_level', function (User $user) {
+ return $user->user_level ? e($user->user_level->getLang('name')) : '';
+ })
+ ->addColumn('is_qual_kp', function (User $user) {
+ return TreeHelperOptimized::generateQualKPBadgeForUser($user, $this->month, $this->year);
+ })
+ ->addColumn('sales_volume_KP_points', function (User $user) {
+ return TreeHelperOptimized::generateSalesVolumeDisplayForUser($user, 'points', $this->month, $this->year);
+ })
+ ->addColumn('sales_volume_total', function (User $user) {
+ return TreeHelperOptimized::generateSalesVolumeDisplayForUser($user, 'total', $this->month, $this->year);
+ })
+ ->addColumn('email', function (User $user) {
+ return e($user->email);
+ })
+ ->addColumn('first_name', function (User $user) {
+ return $user->account ? e($user->account->first_name) : '';
+ })
+ ->addColumn('last_name', function (User $user) {
+ return $user->account ? e($user->account->last_name) : '';
+ })
+ ->addColumn('sponsor', function (User $user) {
+ return TreeHelperOptimized::generateSponsorDisplayForUser($user);
+ })
+ ->addColumn('active_account', function (User $user) {
+ return get_active_badge($user->isActiveAccount());
+ })
+ ->addColumn('next_level_qualified', function (User $user) {
+ // Für Live-DataTable: Verwende bereits berechnete Daten wenn verfügbar
+ $userBusiness = UserBusiness::where('user_id', $user->id)
+ ->where('month', $this->month)
+ ->where('year', $this->year)
+ ->first();
+
+ if ($userBusiness) {
+ return NextLevelBadgeHelper::generateBadgeFromUserBusiness($userBusiness);
+ }
+
+ return NextLevelBadgeHelper::renderNoDataBadge();
+ })
+ ->addColumn('payment_account_date', function (User $user) {
+ return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
+ })
+ ->filterColumn('m_account', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.m_account LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('first_name', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.first_name LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('last_name', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.last_name LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->filterColumn('email', function ($query, $keyword) {
+ if ($keyword != "") {
+ $query->whereRaw("user_businesses.email LIKE ?", '%' . $keyword . '%');
+ }
+ })
+ ->orderColumn('id', 'users.id $1')
+ ->orderColumn('m_account', 'user_accounts.m_account $1')
+ ->orderColumn('first_name', 'first_name $1')
+ ->orderColumn('last_name', 'last_name $1')
+ ->orderColumn('email', 'users.email $1')
+ ->orderColumn('active_account', 'users.payment_account $1')
+ ->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account', 'next_level_qualified'])
+ ->make(true);
+ }
+
+ // ===== PRIVATE HELPER METHODS =====
+
+ /**
+ * Optimierte Stored Search Query
+ */
+ private function initStoredSearchOptimized()
+ {
+ $this->setFilterVars();
+
+ $query = UserBusiness::select('user_businesses.*')
+ ->where('month', $this->month)
+ ->where('year', $this->year);
+
+ $activeFilter = Request::get('business_user_filter_active') ?: session('business_user_filter_active');
+ if ($activeFilter == 1) {
+ $query->where('user_businesses.active_account', 1);
+ } elseif ($activeFilter == 2) {
+ $query->where('user_businesses.active_account', 0);
+ }
+ // activeFilter == 3 bedeutet alle (keine weitere Einschränkung)
+
+ $levelFilter = Request::get('business_user_filter_level') ?: session('business_user_filter_level');
+ if ($levelFilter && $levelFilter != 0) {
+ $query->where('user_businesses.m_level_id', $levelFilter);
+ }
+
+ $nextLevelFilter = Request::get('business_user_filter_next_level') ?: session('business_user_filter_next_level');
+ if ($nextLevelFilter && $nextLevelFilter != 0) {
+ switch ($nextLevelFilter) {
+ case 1: // Qualifiziert (grün) - hat next_qual_user_level
+ $query->whereNotNull('user_businesses.next_qual_user_level')
+ ->where('user_businesses.next_qual_user_level', '!=', '[]');
+ break;
+ case 2: // In Arbeit (gelb) - hat next_can_user_level aber kein next_qual_user_level
+ $query->where(function($q) {
+ $q->whereNull('user_businesses.next_qual_user_level')
+ ->orWhere('user_businesses.next_qual_user_level', '=', '[]');
+ })
+ ->whereNotNull('user_businesses.next_can_user_level')
+ ->where('user_businesses.next_can_user_level', '!=', '[]');
+ break;
+ case 3: // Kein Level (rot) - hat weder next_qual noch next_can
+ $query->where(function($q) {
+ $q->where(function($q1) {
+ $q1->whereNull('user_businesses.next_qual_user_level')
+ ->orWhere('user_businesses.next_qual_user_level', '=', '[]');
+ })
+ ->where(function($q2) {
+ $q2->whereNull('user_businesses.next_can_user_level')
+ ->orWhere('user_businesses.next_can_user_level', '=', '[]');
+ });
+ });
+ break;
+ }
+ }
+
+ return $query;
+ }
+
+ /**
+ * Optimierte Currently Search Query mit besseren Joins
+ */
+ private function initCurrentlySearchOptimized()
+ {
+ $this->setFilterVars();
+
+ $query = User::with(['account', 'user_level', 'user_sponsor.account'])
+ ->select('users.*', 'user_accounts.m_account', 'user_accounts.first_name', 'user_accounts.last_name')
+ ->leftJoin('user_accounts', 'users.id', '=', 'user_accounts.id')
+ ->where('users.deleted_at', '=', null)
+ ->where('users.id', '!=', 1)
+ ->where('users.admin', '<', 4)
+ ->where('users.m_level', '!=', null)
+ ->where('users.payment_account', '!=', null);
+
+ $activeFilter = Request::get('business_user_filter_active') ?: session('business_user_filter_active');
+ if ($activeFilter == 1) {
+ $query->where('users.payment_account', '>=', now());
+ } elseif ($activeFilter == 2) {
+ $query->where('users.payment_account', '<', now());
+ }
+ // activeFilter == 3 bedeutet alle (keine weitere Einschränkung)
+
+ $levelFilter = Request::get('business_user_filter_level') ?: session('business_user_filter_level');
+ if ($levelFilter && $levelFilter != 0) {
+ $query->where('users.m_level', $levelFilter);
+ }
+
+ // Next-Level-Filter wird bei Live-Berechnungen ignoriert (Performance-Gründe)
+ // Dieser Filter funktioniert nur mit gespeicherten Daten
+ $nextLevelFilter = Request::get('business_user_filter_next_level') ?: session('business_user_filter_next_level');
+ if ($nextLevelFilter && $nextLevelFilter != 0) {
+ Log::info("BusinessControllerOptimized: Next-Level-Filter bei Live-Berechnung ignoriert (Performance-Gründe)");
+ }
+
+ return $query;
+ }
+
+ /**
+ * Filter-Variablen setzen (identisch zur Original-Version)
+ */
+ private function setFilterVars()
+ {
+ if (!session('business_user_filter_month')) {
+ session(['business_user_filter_month' => intval(date('m'))]);
+ }
+ if (!session('business_user_filter_year')) {
+ session(['business_user_filter_year' => intval(date('Y'))]);
+ }
+ if (!session('business_user_filter_active')) {
+ session(['business_user_filter_active' => 1]);
+ }
+ if (!session('business_user_filter_level')) {
+ session(['business_user_filter_level' => 0]);
+ }
+ if (!session('business_user_filter_next_level')) {
+ session(['business_user_filter_next_level' => 0]);
+ }
+ if (!session('business_user_filter_depiction')) {
+ session(['business_user_filter_depiction' => 'active']);
+ }
+
+ if (Request::get('business_user_filter_depiction')) {
+ session(['business_user_filter_depiction' => Request::get('business_user_filter_depiction')]);
+ }
+ if (Request::get('business_user_filter_name')) {
+ session(['business_user_filter_name' => Request::get('business_user_filter_name')]);
+ } else {
+ session(['business_user_filter_name' => '']);
+ }
+ if (Request::get('business_user_filter_active')) {
+ session(['business_user_filter_active' => Request::get('business_user_filter_active')]);
+ }
+ if (Request::get('business_user_filter_level')) {
+ session(['business_user_filter_level' => Request::get('business_user_filter_level')]);
+ } else {
+ session(['business_user_filter_level' => 0]);
+ }
+ if (Request::get('business_user_filter_next_level')) {
+ session(['business_user_filter_next_level' => Request::get('business_user_filter_next_level')]);
+ } else {
+ session(['business_user_filter_next_level' => 0]);
+ }
+ if (Request::get('business_user_filter_month')) {
+ session(['business_user_filter_month' => Request::get('business_user_filter_month')]);
+ }
+ if (Request::get('business_user_filter_year')) {
+ session(['business_user_filter_year' => Request::get('business_user_filter_year')]);
+ }
+ }
+
+ /**
+ * Formatiert Bytes in lesbare Einheiten
+ */
+ private function formatBytes(int $bytes, int $precision = 2): string
+ {
+ $units = array('B', 'KB', 'MB', 'GB', 'TB');
+
+ for ($i = 0; $bytes > 1024 && $i < count($units) - 1; $i++) {
+ $bytes /= 1024;
+ }
+
+ return round($bytes, $precision) . ' ' . $units[$i];
+ }
+
+ /**
+ * Holt verfügbare User Level für Filter
+ */
+ private function getFilterLevels(): array
+ {
+ $levels = [0 => 'Alle Level'];
+
+ $userLevels = \App\Models\UserLevel::orderBy('pos')->get(['id', 'name']);
+ foreach ($userLevels as $level) {
+ $levels[$level->id] = $level->name;
+ }
+
+ return $levels;
+ }
+
+ // Performance-optimierte Badge-Generierung wurde in NextLevelBadgeHelper ausgelagert
+ // Alte performance-lastige Methoden wurden entfernt um die Datatable-Performance zu verbessern
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index fc6386ec..8aba4fde 100755
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -129,6 +129,21 @@ class HomeController extends Controller
return abort(404);
}
*/
+ public function zahlungsarten(){
+ return view('web.templates.zahlungsarten', [
+ 'user_shop' => Util::getUserShop(),
+ 'isMivitaShop' => Util::isMivitaShop(),
+ 'yard_instance' => 'webshop',
+ ]);
+ }
+
+ public function versandkosten(){
+ return view('web.templates.versandkosten', [
+ 'user_shop' => Util::getUserShop(),
+ 'isMivitaShop' => Util::isMivitaShop(),
+ 'yard_instance' => 'webshop',
+ ]);
+ }
public function legalDataProtected()
{
@@ -136,6 +151,7 @@ class HomeController extends Controller
'modal' => false,
'user_shop' => Util::getUserShop(),
'isMivitaShop' => Util::isMivitaShop(),
+ 'yard_instance' => 'webshop',
];
return view('legal.data_protected', $data);
}
@@ -145,15 +161,20 @@ class HomeController extends Controller
$data = [
'modal' => false,
'user_shop' => Util::getUserShop(),
+ 'yard_instance' => 'webshop',
+ 'yard_instance' => 'webshop',
+
];
return view('legal.agb', $data);
}
public function legalImprint()
{
+
$data = [
'modal' => false,
'user_shop' => Util::getUserShop(),
+ 'yard_instance' => 'webshop',
];
return view('legal.imprint', $data);
}
diff --git a/app/Http/Controllers/LeadController.php b/app/Http/Controllers/LeadController.php
index cd326e5a..5fbb6d40 100755
--- a/app/Http/Controllers/LeadController.php
+++ b/app/Http/Controllers/LeadController.php
@@ -84,7 +84,7 @@ class LeadController extends Controller
$user->account->shipping_country_id = 1;
$user->id = "new";
}else{
- $user = User::findOrFail($id);
+ $user = User::withTrashed()->findOrFail($id);
if(!$user->account){
$user->account = new UserAccount();
}
@@ -122,7 +122,7 @@ class LeadController extends Controller
$user->account->shipping_country_id = 1;
$user->id = "new";
}else{
- $user = User::findOrFail($id);
+ $user = User::withTrashed()->findOrFail($id);
if(!$user->account){
$user->account = new UserAccount();
}
diff --git a/app/Http/Controllers/ModalController.php b/app/Http/Controllers/ModalController.php
index f84ff360..53639a80 100644
--- a/app/Http/Controllers/ModalController.php
+++ b/app/Http/Controllers/ModalController.php
@@ -16,6 +16,7 @@ use App\Models\HomepartyUser;
use App\Models\ShoppingOrder;
use App\Models\UserSalesVolume;
use App\Services\BusinessPlan\TreeCalcBot;
+use App\Services\BusinessPlan\TreeCalcBotOptimized;
class ModalController extends Controller
{
@@ -122,6 +123,8 @@ class ModalController extends Controller
$data['month'] = session('team_user_filter_month');
$data['year'] = session('team_user_filter_year');
}
+ $data['live'] = $data['live'] ?? false;
+ $data['optimized'] = $data['optimized'] ?? false;
$TreeCalcBot = $this->getForBusinessUserDetail($user, $data);
$route = "";
$ret = view("admin.modal.business_user_detail", compact('TreeCalcBot', 'user', 'data'))->render();
@@ -176,9 +179,13 @@ class ModalController extends Controller
//$auth_user = \Auth::user();
//if($auth_user->isAdmin() || $auth_user->id === $user->id){
+ if($data['optimized']){
+ $TreeCalcBot = new TreeCalcBotOptimized($data['month'], $data['year'], $data['init_from'], $data['live']);
+ }else{
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], $data['init_from']);
- $TreeCalcBot->initBusinesslUserDetail($user);
-//TODO is not Admin, read is user in Parent tree ...
+ }
+ $TreeCalcBot->initBusinesslUserDetail($user, $data['live']);
+ //TODO is not Admin, read is user in Parent tree ...
if(!$TreeCalcBot->business_user){
abort(403, 'no user found');
}
diff --git a/app/Http/Controllers/PaymentMethodController.php b/app/Http/Controllers/PaymentMethodController.php
index fbea8b4a..b0c0d9a5 100755
--- a/app/Http/Controllers/PaymentMethodController.php
+++ b/app/Http/Controllers/PaymentMethodController.php
@@ -36,7 +36,7 @@ class PaymentMethodController extends Controller
'short' => $data['short'],
'pos' => $data['pos'],
'show_on' => isset($data['show_on']) ? $data['show_on'] : null,
- 'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : null,
+ 'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : false,
'default' => isset($data['default']) ? true : false,
'active' => isset($data['active']) ? true : false,
]);
diff --git a/app/Http/Controllers/Portal/AboController.php b/app/Http/Controllers/Portal/AboController.php
new file mode 100644
index 00000000..4bf0f27a
--- /dev/null
+++ b/app/Http/Controllers/Portal/AboController.php
@@ -0,0 +1,311 @@
+middleware('auth:customers');
+ $this->yard = Yard::instance($this->instance);
+ }
+
+
+ public function myAbo()
+ {
+ $user = Auth::guard('customers')->user();
+
+ if (!$user->shopping_user_id) {
+ return view('portal.abo.my_abo_create', [
+ 'user' => $user,
+ 'no_shopping_user' => true,
+ 'step' => 0,
+ ]);
+ }
+
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $user_abo = UserAbo::where('email', $shopping_user->billing_email)
+ ->where('status', '>', 1)
+ ->first();
+
+ return $user_abo
+ ? view('portal.abo.my_abo', ['user_abo' => $user_abo])
+ : view('portal.abo.my_abo_create', [
+ 'shopping_user' => $shopping_user,
+ 'step' => 0,
+ ]);
+ }
+
+ public function myAboCreate($step)
+ {
+ $user = Auth::guard('customers')->user();
+
+ if (!$user->shopping_user_id) {
+ abort(403, 'Unauthorized action.');
+ }
+
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $data = $this->prepareAboCreateData($shopping_user, $step);
+ if(isset($data['checkout_url'])){
+ return redirect($data['checkout_url']);
+ }
+ return view('portal.abo.my_abo_create', $data);
+ }
+
+ private function prepareAboCreateData($shopping_user, $step)
+ {
+ $data = [
+ 'shopping_user' => $shopping_user,
+ 'basis_products' => Product::where('active', true)
+ ->whereJsonContains('show_on', ['12'])
+ ->orderBy('pos', 'ASC')
+ ->get(),
+ 'upgrade_products' => Product::where('active', true)
+ ->whereJsonContains('show_on', ['13'])
+ ->orderBy('pos', 'ASC')
+ ->get(),
+ 'step' => 0,
+ ];
+ if(Request::get('action') == 'back') {
+ $step = $step - 2;
+ }
+
+ switch ($step) {
+ case 0:
+ $data['step'] = 0;
+ break;
+ case 1:
+ $this->initYard($shopping_user);
+ $data['step'] = 1;
+ break;
+ case 2:
+ UserService::setInstance($this->instance);
+ UserService::initCustomerYard($shopping_user, 'abo-ot-customer');
+ $data['step'] = 2;
+ break;
+ case 3:
+ UserService::setInstance($this->instance);
+ UserService::initCustomerYard($shopping_user, 'abo-ot-customer');
+ if(Request::get('action') == 'next'){
+ if (!$this->checkBasisProduct()) {
+ $data['error'] = __('abo.abo_error_basis_product');
+ $data['step'] = 2;
+ } else {
+ $data['step'] = 3;
+ }
+ }else{
+ $data['step'] = 3;
+ }
+ break;
+ case 4:
+ UserService::setInstance($this->instance);
+ UserService::initCustomerYard($shopping_user, 'abo-ot-customer');
+ $this->upgradeProductToCart();
+ $data['step'] = 4;
+ break;
+ case 5:
+ //chekout verarbeiten
+ UserService::setInstance($this->instance);
+ UserService::initCustomerYard($shopping_user, 'abo-ot-customer');
+ if(Request::get('action') == 'checkout'){
+ //checkout verarbeiten
+ if (!$this->preCheckCheckout()) {
+ $data['error'] = __('abo.abo_error_basis_product');
+ $data['step'] = 4;
+ } else {
+ $data['checkout_url'] = $this->processCheckout();
+ }
+ }
+ $data['step'] = 4;
+ break;
+ default:
+ abort(404, 'Page not found.');
+ }
+
+ return $data;
+ }
+
+ private function initYard($shopping_user)
+ {
+ $delivery_country = $shopping_user->getDeliveryCountry(true);
+
+ if (!$delivery_country) {
+ abort(404, 'No delivery country found, please edit your personal data.');
+ }
+
+ \Session::put('user_init_country', strtolower($delivery_country->code));
+ \Session::forget('user_init_country_options');
+ \Session::put('locale', strtolower(\App::getLocale()));
+
+ Shop::initUserShopLang($delivery_country, $this->instance);
+ }
+
+ private function preCheckCheckout(){
+ $result = false;
+ //alle inhlate des warenkorb
+ $cartItems = $this->yard->content();
+ foreach($cartItems as $item){
+ if(in_array(12, $item->options->show_on)){
+ $result = true;
+ }
+ }
+ return $result;
+ }
+
+
+
+ private function checkBasisProduct()
+ {
+ $data = Request::all();
+ $result = false;
+
+ if (!isset($data['base_product_qty'])) {
+ return false;
+ }
+
+ foreach ($data['base_product_qty'] as $product_id => $quantity) {
+ $product = Product::find($product_id);
+
+ if (!$product || intval($quantity) <= 0) {
+ continue;
+ }
+ $result = true;
+ $this->addProductToCart($product, $quantity);
+
+ }
+
+ return $result;
+ }
+
+ private function upgradeProductToCart(){
+ $data = Request::all();
+ $result = false;
+
+ if (!isset($data['upgrade_product_qty'])) {
+ return false;
+ }
+
+ foreach ($data['upgrade_product_qty'] as $product_id => $quantity) {
+ $product = Product::find($product_id);
+
+ if (!$product) {
+ continue;
+ }
+
+ $result = true;
+ $this->addProductToCart($product, $quantity);
+ }
+
+ return $result;
+ }
+
+ private function addProductToCart($product, $quantity)
+ {
+ // Suche nach dem Produkt im Warenkorb
+ $cartItems = $this->yard->search(function($item) use ($product) {
+ return $item->id === $product->id;
+ });
+
+ // Wenn die Menge 0 ist, entferne das Produkt
+ if ($quantity <= 0) {
+ foreach ($cartItems as $item) {
+ $this->yard->remove($item->rowId);
+ }
+ return;
+ }
+
+ $image = $product->images->first()->slug ?? '';
+ $price = $product->getPriceWith(
+ $this->yard->getUserTaxFree(),
+ false,
+ $this->yard->getUserCountry()
+ );
+
+ // Wenn das Produkt bereits im Warenkorb ist, aktualisiere die Menge
+ if ($cartItems->count() > 0) {
+ $cartItem = $cartItems->first();
+ $this->yard->update($cartItem->rowId, $quantity);
+ } else {
+ // Wenn das Produkt noch nicht im Warenkorb ist, füge es hinzu
+ $cartItem = $this->yard->add(
+ $product->id,
+ $product->getLang('name'),
+ $quantity,
+ $price,
+ false,
+ false,
+ [
+ 'image' => $image,
+ 'slug' => $product->slug,
+ 'weight' => $product->weight,
+ 'points' => $product->points,
+ 'no_commission' => $product->no_commission,
+ 'no_free_shipping' => $product->no_free_shipping,
+ 'show_on' => $product->show_on
+ ]
+ );
+ }
+
+ // $this->setProductTax($cartItem, $product);
+ $this->yard->reCalculateShippingPrice();
+ }
+
+
+ private function processCheckout(){
+ $user_shop = Util::getUserShop();
+ if(!$user_shop){
+ $user_shop = Util::getDefaultUserShop();
+ }
+ do {
+ $identifier = Util::getToken();
+ } while( ShoppingInstance::where('identifier', $identifier)->count() );
+
+ $data = [];
+ $data['is_from'] = 'shopping';
+ $data['user_price_infos'] = $this->yard->getUserPriceInfos();
+
+ ShoppingInstance::create([
+ 'identifier' => $identifier,
+ 'user_shop_id' => $user_shop->id,
+ 'payment' => 1, //Customer Shop Payment
+ 'subdomain' => url('/'),
+ 'country_id' => $this->yard->getShippingCountryId(),
+ 'language' => \App::getLocale(),
+ 'shopping_data' => $data,
+ 'back' => url()->previous(),
+
+ ]);
+
+ $this->yard->store($identifier);
+ //add to DB
+ $path = route('checkout.checkout_card', ['identifier'=>$identifier]);
+ if(strpos($path, 'https') === false){
+ $path = str_replace('http', 'https', $path);
+ }
+ return $path;
+ }
+}
diff --git a/app/Http/Controllers/Portal/Auth/LoginController.php b/app/Http/Controllers/Portal/Auth/LoginController.php
new file mode 100755
index 00000000..e55193ec
--- /dev/null
+++ b/app/Http/Controllers/Portal/Auth/LoginController.php
@@ -0,0 +1,203 @@
+check()){
+ return redirect()->route('portal.change_login');
+ }
+ //wenn als Kunde eingeloggt, dann direkt zum Dashboard
+ if (Auth::guard('customers')->check()) {
+ return redirect()->route('portal.dashboard');
+ }
+ return view('portal.auth.login'); // Erstelle diese View
+ }
+
+ // Sendet das OTP
+ public function sendOtp(Request $request)
+ {
+ $request->validate(['email' => 'required|email']);
+ $email = $request->input('email');
+
+ // 1. Prüfen, ob die E-Mail im System bekannt ist über Kunden-Tabelle)
+ $customer = Customer::firstOrCreate(['email' => $email]); // Erstellt Kunden, wenn nicht vorhanden
+ if($customer && $customer->language){
+ \App::setLocale($customer->language);
+ }
+
+ // if (!$customerExists && !$orderExists) { // Oder nur eine Prüfung, je nach Logik
+ if (!$customer) { // Prüfung anhand des Customer-Models
+ throw ValidationException::withMessages([
+ 'email' => __('auth.failed_customer'), // Generische Fehlermeldung
+ ]);
+ }
+ // 2. Alten Token löschen (optional, aber empfohlen)
+ DB::table('otp_tokens')->where('email', $email)->delete();
+
+ // 3. OTP generieren (z.B. 6-stellige Zahl)
+ $otp = random_int(100000, 999999);
+ $expiresAt = Carbon::now()->addMinutes(10); // Gültigkeit z.B. 10 Minuten
+
+ // 4. OTP (gehasht!) speichern
+ DB::table('otp_tokens')->insert([
+ 'email' => $email,
+ 'token' => Hash::make((string)$otp), // WICHTIG: Token hashen!
+ 'expires_at' => $expiresAt,
+ 'created_at' => Carbon::now(),
+ ]);
+
+ // 5. OTP per E-Mail senden (Notification oder Mailable verwenden)
+ try {
+ Mail::to($email)->locale(\App::getLocale())->send(new MailOTPCustomer($otp, $email));
+ } catch (\Exception $e) {
+ // Logge den Fehler
+ \Log::error('OTP Send Error: ' . $e->getMessage());
+ // Gib eine Fehlermeldung zurück, ohne Details preiszugeben
+ return back()->withErrors(['email' => 'Konnte E-Mail nicht senden. Bitte versuchen Sie es später erneut.'])->withInput();
+ }
+
+
+ // 6. Zum OTP-Eingabeformular weiterleiten (E-Mail in Session speichern oder als Parameter übergeben)
+ session(['otp_email' => $email]); // Explizit in Session speichern
+ return redirect()->route('portal.login.otp.form', ['email' => $email]); // E-Mail auch als Parameter übergeben
+ }
+
+ // Zeigt das Formular zur Eingabe des OTP an
+ public function showOtpForm(Request $request, $email = null, $otp = null)
+ {
+ //wenn als Berater eingeloggt, dann zum Login wechseln
+ if(Auth::guard('user')->check()){
+ return redirect()->route('portal.change_login');
+ }
+ //wenn als Kunde eingeloggt, dann zum Dashboard wechseln
+ if (Auth::guard('customers')->check()) {
+ return redirect()->route('portal.dashboard');
+ }
+ // E-Mail aus der Session holen (oder als Request-Parameter erwarten)
+ if($email) {
+ $email = $email;
+ } else {
+ $email = session('otp_email', $request->query('email'));
+ }
+ if (!$email) {
+ return redirect()->route('portal.login.form')->withErrors(['message' => 'Sitzung abgelaufen oder E-Mail fehlt.']);
+ }
+
+ // CSRF-Token regenerieren für neue Session
+ $request->session()->regenerateToken();
+
+ // Übergebe sowohl 'email' als auch 'otp' an die View
+ return view('portal.auth.verify-otp', ['email' => $email, 'otp_value' => $otp]); // Variable umbenannt zu otp_value für Klarheit
+ }
+
+ // Validiert das OTP und loggt den Kunden ein
+ public function verifyOtpAndLogin(Request $request)
+ {
+ $request->validate([
+ 'email' => 'required|email',
+ 'otp' => 'required|numeric|digits:6', // An die Länge deines OTPs anpassen
+ ]);
+
+ $email = $request->input('email');
+ $otpInput = $request->input('otp');
+
+ // 1. Gespeicherten OTP-Eintrag finden
+ $otpRecord = DB::table('otp_tokens')->where('email', $email)->first();
+
+ // 2. Prüfen ob Eintrag existiert, nicht abgelaufen ist und das OTP (Hash) übereinstimmt
+ if (!$otpRecord || Carbon::now()->gt($otpRecord->expires_at) || !Hash::check($otpInput, $otpRecord->token)) {
+ // Ungültiges oder abgelaufenes OTP
+ DB::table('otp_tokens')->where('email', $email)->delete(); // Ungültigen Token löschen
+ return back()->withErrors(['otp' => 'Ungültiges oder abgelaufenes Einmalpasswort.'])->withInput(['email' => $email]);
+ }
+ // 3. Kunden-Objekt finden (basierend auf dem Provider-Model)
+ $customer = Customer::where('email', $email)->first(); // Oder User::where('email', $email)->where('role','customer')->first();
+
+ if (!$customer) {
+ // Sollte eigentlich nicht passieren, wenn sendOtp korrekt funktioniert hat
+ DB::table('otp_tokens')->where('email', $email)->delete();
+ return back()->withErrors(['otp' => __('auth.failed')])->withInput(['email' => $email]);
+ }
+ // 4. Kunden einloggen über den 'customers'-Guard
+ Auth::guard('customers')->login($customer); // Loggt den gefundenen Kunden ein
+
+ // 5. Explizite Session-Speicherung
+ $request->session()->save();
+
+ // 6. OTP-Eintrag löschen
+ DB::table('otp_tokens')->where('email', $email)->delete();
+
+ // 7. Session Token regenerieren (statt komplette Session)
+ $request->session()->regenerate();
+
+ // 8. customer DB aktualisieren
+ $shopping_user = ShoppingUser::where('billing_email', $email)->latest()->first();
+ if($shopping_user){
+ $data = [
+ 'name' => $shopping_user->billing_firstname . ' ' . $shopping_user->billing_lastname,
+ 'shopping_user_id' => $shopping_user->id,
+ 'member_id' => $shopping_user->member_id,
+ 'number' => $shopping_user->number,
+ 'language' => session('locale') ?? 'de',
+ ];
+ $customer->update($data);
+ }else{
+ $data = [
+ 'name' => __('portal.guest'),
+ 'shopping_user_id' => null,
+ 'member_id' => null,
+ 'number' => null,
+ 'language' => session('locale') ?? 'de',
+ ];
+ $customer->update($data);
+ }
+
+
+ // 10. Zum Kunden-Dashboard weiterleiten
+ return redirect()->intended(route('portal.dashboard')); // intended() leitet zur ursprünglich angefragten Seite weiter
+ }
+
+ // Logout für Kunden
+ public function logout(Request $request)
+ {
+ $url = Util::getMyMivitaShopUrl();
+ Auth::guard('customers')->logout();
+ $request->session()->invalidate();
+ $request->session()->regenerateToken();
+ return redirect($url);
+ }
+
+ // Logout für Berater
+ public function logoutChange(Request $request)
+ {
+ //$url = Util::getMyMivitaShopUrl();
+ $user_shop_domain = session('user_shop_domain');
+ $locale = session('locale');
+ Auth::guard('user')->logout();
+ $request->session()->invalidate();
+ $request->session()->regenerateToken();
+ session(['user_shop_domain' => $user_shop_domain]);
+ session(['locale' => $locale]);
+ return redirect()->route('portal.login.form');
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Portal/CustomerController.php b/app/Http/Controllers/Portal/CustomerController.php
new file mode 100644
index 00000000..da5b9a79
--- /dev/null
+++ b/app/Http/Controllers/Portal/CustomerController.php
@@ -0,0 +1,99 @@
+middleware('auth:customers');
+ }
+
+
+ public function myDataEdit()
+ {
+ $user = Auth::guard('customers')->user();
+ if($user->shopping_user_id){
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ }else{
+ $shopping_user = new ShoppingUser();
+ }
+ $data = [
+ 'shopping_user' => $shopping_user,
+ 'isAdmin' => false,
+ 'isView' => 'customer',
+ ];
+ return view('portal.customer.edit', $data);
+
+ }
+
+ public function myDataStore(){
+ $user = Auth::guard('customers')->user();
+ $data = Request::all();
+
+
+ if($data['action'] === 'shopping-user-store-new' || $data['action']==='shopping-user-store'){
+ $rules = array(
+ 'billing_salutation' => 'required',
+ 'billing_firstname'=>'required',
+ 'billing_lastname'=>'required',
+ 'billing_address'=>'required',
+ 'billing_zipcode'=>'required',
+ 'billing_city' => 'required',
+ 'billing_country_id' => 'required',
+ );
+
+ if(!Request::get('same_as_billing')){
+ $rules = array_merge($rules, [
+ 'shipping_firstname'=>'required',
+ 'shipping_lastname'=>'required',
+ 'shipping_address'=>'required',
+ 'shipping_zipcode'=>'required',
+ 'shipping_city' => 'required',
+ 'shipping_salutation' => 'required',
+ 'shipping_country_id' => 'required'
+ ]);
+ }
+ $validator = Validator::make(Request::all(), $rules);
+ if ($validator->fails()) {
+ return back()->withErrors($validator)->withInput(Request::all());
+ }
+ }
+ $data['language'] = \App::getLocale();
+ $data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
+ $data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
+ if($user->shopping_user_id){
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $shopping_user->fill($data);
+ $shopping_user->save();
+ }else{
+ $data['billing_email'] = $user->email;
+ $shopping_user = ShoppingUser::create($data);
+ $user->shopping_user_id = $shopping_user->id;
+ $user->save();
+ //kundenhoheit
+ CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
+
+
+ }
+
+
+ \Session()->flash('alert-save', true);
+
+ return redirect(route('portal.my_data.edit'));
+ }
+
+}
diff --git a/app/Http/Controllers/Portal/InController.php b/app/Http/Controllers/Portal/InController.php
new file mode 100755
index 00000000..df553eba
--- /dev/null
+++ b/app/Http/Controllers/Portal/InController.php
@@ -0,0 +1,132 @@
+check()){
+ return redirect(route('portal.change_login'));
+ }
+ if(!Auth::guard('customers')->check()){ // if () {
+ return redirect(route('portal.login.form'));
+ }
+ return redirect(route('portal.dashboard'));
+
+ }
+
+ public function changeLogin(){
+ if(Auth::guard('customers')->check()){
+ return redirect(route('portal.dashboard'));
+ }
+ if(Auth::guard('user')->check()){
+ return view('portal.auth.change');
+
+ }
+ return redirect(route('portal.login.form'));
+
+ }
+
+ public function dashboard()
+ {
+ if(!Auth::guard('customers')->check()){
+ return redirect(route('portal.login.form'));
+ }
+ $data = [
+ 'user' => Auth::guard('customers')->user(),
+ 'now' => Carbon::now(),
+ ];
+ return view('portal.dashboard', $data);
+ }
+
+ public function loadingModal(){
+
+ $data = Request::all();
+
+
+ $response = "";
+ $status = false;
+
+ if(isset($data['action']) && $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();
+ return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
+
+ }
+ $data = Request::get('data');
+ $target = Request::get('target');
+ if($data === "data_protection"){
+ $data = [
+ 'modal' => true,
+ 'user_shop' => true,
+ 'isMivitaShop' => false,
+ ];
+ $response = view('legal.data_protect_de', $data)->render();
+ }
+ if($data === "imprint"){
+ $data = [
+ 'modal' => true,
+ 'user_shop' => Util::getUserShop(),
+ ];
+ $response = view('legal.imprint_de', $data)->render();
+ }
+ if($data === "shop_term_of_use"){
+ $data = [
+ 'modal' => true,
+ 'user_shop' => Util::getUserShop(),
+ ];
+ $response = view('legal.shop_term_of_use_de', $data)->render();
+ }
+ if($data === "agb"){
+ $data = [
+ 'modal' => true,
+ 'user_shop' => Util::getUserShop(),
+ ];
+ $response = view('legal.agb_de', $data)->render();
+ }
+ if(Request::ajax()) {
+ return response()->json(['response' => $response, 'target'=>$target]);
+ }
+ abort(404);
+ }
+
+
+
+ /* public function goToShop(){
+
+ if(!Auth::guard('customers')->check()){
+ return redirect(config('app.protocol') . config('app.domain') . config('app.tld_shop'));
+ }
+ $customer = Auth::guard('customers')->user();
+ //subdmain for member
+ $member = User::where('email', $customer->email)->first();
+ if($member){
+ return redirect(config('app.protocol') . $member->subdomain . config('app.tld_care'));
+ }
+ // $customer->member_id
+
+ // return redirect(config('app.protocol') . config('app.domain') . config('app.tld_shop'));
+ }*/
+}
diff --git a/app/Http/Controllers/Portal/OrderController.php b/app/Http/Controllers/Portal/OrderController.php
new file mode 100644
index 00000000..aeab71f6
--- /dev/null
+++ b/app/Http/Controllers/Portal/OrderController.php
@@ -0,0 +1,116 @@
+middleware('auth:customers');
+ }
+
+
+ public function myOrders()
+ {
+ $user = Auth::guard('customers')->user();
+ if($user->shopping_user_id){
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $shopping_orders = $shopping_user->getAllOrdersByMember();
+ }else{
+ $shopping_user = new ShoppingUser();
+ $shopping_orders = [];
+ }
+ $data = [
+ 'shopping_user' => $shopping_user,
+ 'shopping_orders' => $shopping_orders,
+ ];
+ return view('portal.order.my_orders', $data);
+
+ }
+
+ public function myOrderShow($id)
+ {
+ $user = Auth::guard('customers')->user();
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $shopping_order = ShoppingOrder::findOrFail($id);
+ if($shopping_order->shopping_user_id != $user->shopping_user_id){
+ abort(403, 'Unauthorized action.');
+ }
+ return view('portal.order.my_order_show', [
+ 'shopping_order' => $shopping_order,
+ 'shopping_user' => $shopping_user,
+ ]);
+ }
+
+ public function myOrderCreate($id)
+ {
+ $user = Auth::guard('customers')->user();
+ $shopping_order = ShoppingOrder::findOrFail($id);
+ if($shopping_order->shopping_user_id != $user->shopping_user_id){
+ abort(403, 'Unauthorized action.');
+ }
+ $shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
+ $delivery_country = $shopping_user->getDeliveryCountry(true);
+
+ \Session::put('user_init_country', strtolower($delivery_country->code));
+ \Session::forget('user_init_country_options');
+ \Session::put('locale', strtolower(\App::getLocale()));
+
+ Shop::initUserShopLang($delivery_country, $this->instance);
+
+ //init Yard
+
+ foreach($shopping_order->shopping_order_items as $shopping_order_item){
+ if($shopping_order_item->product){
+ $this->addToCard($shopping_order_item->product_id, $shopping_order_item->qty);
+ }
+ }
+ $url = Util::getMyMivitaShopUrl("/user/card/show");
+ return redirect($url);
+ }
+
+
+ private function addToCard($id, $quantity = 1)
+ {
+ $product = Product::find($id);
+ if($product){
+ $image = "";
+ if($product->images->count()){
+ $image = $product->images->first()->slug;
+ }
+ $cartItem = Yard::instance($this->instance)
+ ->add($product->id, $product->getLang('name'), $quantity,
+ $product->getPriceWith(Yard::instance($this->instance)->getUserTaxFree(), false, Yard::instance($this->instance)->getUserCountry()), false, false,
+ ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'show_on' => $product->show_on]);
+ if(Yard::instance($this->instance)->getUserTaxFree()){
+ Yard::setTax($cartItem->rowId, 0);
+ }else{
+ Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance($this->instance)->getUserCountry()));
+ }
+ Yard::instance($this->instance)->reCalculateShippingPrice();
+
+ \Session()->flash('show-card-after-add', true);
+ }
+ }
+
+
+
+}
diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php
index 0b25ef06..8a009c98 100755
--- a/app/Http/Controllers/ProductController.php
+++ b/app/Http/Controllers/ProductController.php
@@ -59,7 +59,6 @@ class ProductController extends Controller
public function store()
{
$data = Request::all();
-
$rules = array(
'name' => 'required',
);
@@ -189,7 +188,7 @@ class ProductController extends Controller
return redirect(route('admin_product_edit', [$product->id]));
}
- catch (Exception $e) {
+ catch ( \Exception $e) {
\Session()->flash('alert-danger', "Fehler".$e);
return redirect(route('admin_product_edit', [$product->id]));
}
diff --git a/app/Http/Controllers/RevenueReportController.php b/app/Http/Controllers/RevenueReportController.php
new file mode 100644
index 00000000..1422eab3
--- /dev/null
+++ b/app/Http/Controllers/RevenueReportController.php
@@ -0,0 +1,343 @@
+middleware('admin');
+ }
+
+ public function index()
+ {
+ $this->setFilterVars();
+
+ $data = [
+ 'filter_months' => HTMLHelper::getTransMonths(),
+ 'filter_years' => HTMLHelper::getYearRange(2022),
+ 'revenue_summary' => $this->getRevenueSummary(),
+ 'credit_summary' => $this->getCreditSummary()
+ ];
+
+ return view('admin.revenue.index', $data);
+ }
+
+ public function export()
+ {
+ $this->setFilterVars();
+
+ $filter_year = session('revenue_filter_year');
+
+ // Get data like in the HTML view
+ $revenue_summary = $this->getRevenueSummary();
+ $credit_summary = $this->getCreditSummary();
+
+ $filename = "umsatz-gutschrift-bericht-{$filter_year}";
+
+ $columns = [];
+
+ // Umsätze Section Header
+ $columns[] = ['Typ' => 'UMSÄTZE', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+
+ // Yearly Revenue Summary
+ if(isset($revenue_summary['yearly']) && $revenue_summary['yearly']->count() > 0) {
+ foreach($revenue_summary['yearly'] as $item) {
+ $columns[] = [
+ 'Typ' => $item->period_label,
+ 'Netto' => number_format($item->total_net, 2, ',', '.'),
+ 'Steuer' => number_format($item->total_tax, 2, ',', '.'),
+ 'Brutto' => number_format($item->total_gross, 2, ',', '.')
+ ];
+ }
+ } else {
+ $columns[] = [
+ 'Typ' => "Jahr {$filter_year}",
+ 'Netto' => '0,00',
+ 'Steuer' => '0,00',
+ 'Brutto' => '0,00'
+ ];
+ }
+
+ // Empty row
+ $columns[] = ['Typ' => '', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+
+ // Monthly Revenue Breakdown
+ $columns[] = ['Typ' => 'MONATLICHE AUFSCHLÜSSELUNG UMSÄTZE', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+ if(isset($revenue_summary['monthly']) && $revenue_summary['monthly']->count() > 0) {
+ foreach($revenue_summary['monthly'] as $item) {
+ $columns[] = [
+ 'Typ' => $item->period_label,
+ 'Netto' => number_format($item->total_net, 2, ',', '.'),
+ 'Steuer' => number_format($item->total_tax, 2, ',', '.'),
+ 'Brutto' => number_format($item->total_gross, 2, ',', '.')
+ ];
+ }
+ } else {
+ $columns[] = [
+ 'Typ' => 'Keine monatlichen Umsätze gefunden',
+ 'Netto' => '',
+ 'Steuer' => '',
+ 'Brutto' => ''
+ ];
+ }
+
+ // Two empty rows for separation
+ $columns[] = ['Typ' => '', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+ $columns[] = ['Typ' => '', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+
+ // Gutschriften Section Header
+ $columns[] = ['Typ' => 'GUTSCHRIFTEN', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+
+ // Yearly Credit Summary
+ if(isset($credit_summary['yearly']) && $credit_summary['yearly']->count() > 0) {
+ foreach($credit_summary['yearly'] as $item) {
+ $columns[] = [
+ 'Typ' => $item->period_label,
+ 'Netto' => number_format($item->total_net, 2, ',', '.'),
+ 'Steuer' => number_format($item->total_tax, 2, ',', '.'),
+ 'Brutto' => number_format($item->total_gross, 2, ',', '.')
+ ];
+ }
+ } else {
+ $columns[] = [
+ 'Typ' => "Jahr {$filter_year}",
+ 'Netto' => '0,00',
+ 'Steuer' => '0,00',
+ 'Brutto' => '0,00'
+ ];
+ }
+
+ // Empty row
+ $columns[] = ['Typ' => '', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+
+ // Monthly Credit Breakdown
+ $columns[] = ['Typ' => 'MONATLICHE AUFSCHLÜSSELUNG GUTSCHRIFTEN', 'Netto' => '', 'Steuer' => '', 'Brutto' => ''];
+ if(isset($credit_summary['monthly']) && $credit_summary['monthly']->count() > 0) {
+ foreach($credit_summary['monthly'] as $item) {
+ $columns[] = [
+ 'Typ' => $item->period_label,
+ 'Netto' => number_format($item->total_net, 2, ',', '.'),
+ 'Steuer' => number_format($item->total_tax, 2, ',', '.'),
+ 'Brutto' => number_format($item->total_gross, 2, ',', '.')
+ ];
+ }
+ } else {
+ $columns[] = [
+ 'Typ' => 'Keine monatlichen Gutschriften gefunden',
+ 'Netto' => '',
+ 'Steuer' => '',
+ 'Brutto' => ''
+ ];
+ }
+
+ $headers = ['Zeitraum', 'Netto (€)', 'Steuer (€)', 'Brutto (€)'];
+
+ return Excel::download(new UserTeamExport($columns, $headers), $filename . '.xlsx');
+ }
+
+ private function setFilterVars()
+ {
+ if (!session('revenue_filter_month')) {
+ session(['revenue_filter_month' => intval(date('m'))]);
+ }
+ if (!session('revenue_filter_year')) {
+ session(['revenue_filter_year' => intval(date('Y'))]);
+ }
+ if(!session('revenue_filter_type')){
+ session(['revenue_filter_type' => 'year']);
+ }
+ if (Request::get('revenue_filter_month')) {
+ session(['revenue_filter_month' => Request::get('revenue_filter_month')]);
+ }
+ if (Request::get('revenue_filter_year')) {
+ session(['revenue_filter_year' => Request::get('revenue_filter_year')]);
+ }
+ if (Request::get('revenue_filter_type')) {
+ session(['revenue_filter_type' => Request::get('revenue_filter_type')]);
+ }
+ }
+
+ private function getRevenueSummary()
+ {
+ $year = session('revenue_filter_year');
+
+ return [
+ 'yearly' => $this->getRevenueByYear($year),
+ 'monthly' => $this->getRevenueByMonthsInYear($year)
+ ];
+ }
+
+ private function getCreditSummary()
+ {
+ $year = session('revenue_filter_year');
+
+ return [
+ 'yearly' => $this->getCreditByYear($year),
+ 'monthly' => $this->getCreditByMonthsInYear($year)
+ ];
+ }
+
+ private function getRevenueByYear($year)
+ {
+ return UserInvoice::join('shopping_orders', 'user_invoices.shopping_order_id', '=', 'shopping_orders.id')
+ ->selectRaw("
+ {$year} as year,
+ CONCAT('Jahr ', {$year}) as period_label,
+ SUM(shopping_orders.subtotal_ws) as total_net,
+ SUM(shopping_orders.tax) as total_tax,
+ SUM(shopping_orders.total_shipping) as total_gross
+ ")
+ ->where('user_invoices.year', $year)
+ ->where('user_invoices.cancellation', false)
+ ->groupBy(DB::raw('1'))
+ ->get();
+ }
+
+ private function getRevenueByMonth($year, $month)
+ {
+ return UserInvoice::join('shopping_orders', 'user_invoices.shopping_order_id', '=', 'shopping_orders.id')
+ ->selectRaw("
+ {$year} as year,
+ {$month} as month,
+ CONCAT(CASE {$month}
+ WHEN 1 THEN 'Januar'
+ WHEN 2 THEN 'Februar'
+ WHEN 3 THEN 'März'
+ WHEN 4 THEN 'April'
+ WHEN 5 THEN 'Mai'
+ WHEN 6 THEN 'Juni'
+ WHEN 7 THEN 'Juli'
+ WHEN 8 THEN 'August'
+ WHEN 9 THEN 'September'
+ WHEN 10 THEN 'Oktober'
+ WHEN 11 THEN 'November'
+ WHEN 12 THEN 'Dezember'
+ END, ' ', {$year}) as period_label,
+ SUM(shopping_orders.subtotal_ws) as total_net,
+ SUM(shopping_orders.tax) as total_tax,
+ SUM(shopping_orders.total_shipping) as total_gross
+ ")
+ ->where('user_invoices.year', $year)
+ ->where('user_invoices.month', $month)
+ ->where('user_invoices.cancellation', false)
+ ->groupBy(DB::raw('1'))
+ ->get();
+ }
+
+ private function getRevenueByMonthsInYear($year)
+ {
+ return UserInvoice::join('shopping_orders', 'user_invoices.shopping_order_id', '=', 'shopping_orders.id')
+ ->selectRaw("
+ user_invoices.year,
+ user_invoices.month,
+ CONCAT(CASE user_invoices.month
+ WHEN 1 THEN 'Januar'
+ WHEN 2 THEN 'Februar'
+ WHEN 3 THEN 'März'
+ WHEN 4 THEN 'April'
+ WHEN 5 THEN 'Mai'
+ WHEN 6 THEN 'Juni'
+ WHEN 7 THEN 'Juli'
+ WHEN 8 THEN 'August'
+ WHEN 9 THEN 'September'
+ WHEN 10 THEN 'Oktober'
+ WHEN 11 THEN 'November'
+ WHEN 12 THEN 'Dezember'
+ END, ' ', user_invoices.year) as period_label,
+ SUM(shopping_orders.subtotal_ws) as total_net,
+ SUM(shopping_orders.tax) as total_tax,
+ SUM(shopping_orders.total_shipping) as total_gross
+ ")
+ ->where('user_invoices.year', $year)
+ ->where('user_invoices.cancellation', false)
+ ->groupBy('user_invoices.year', 'user_invoices.month')
+ ->orderBy('user_invoices.month')
+ ->get();
+ }
+
+ private function getCreditByYear($year)
+ {
+ return UserCredit::selectRaw("
+ {$year} as year,
+ CONCAT('Jahr ', {$year}) as period_label,
+ SUM(net) as total_net,
+ SUM(tax) as total_tax,
+ SUM(total) as total_gross
+ ")
+ ->where('year', $year)
+ ->where('cancellation', false)
+ ->groupBy(DB::raw('1'))
+ ->get();
+ }
+
+ private function getCreditByMonth($year, $month)
+ {
+ return UserCredit::selectRaw("
+ {$year} as year,
+ {$month} as month,
+ CONCAT(CASE {$month}
+ WHEN 1 THEN 'Januar'
+ WHEN 2 THEN 'Februar'
+ WHEN 3 THEN 'März'
+ WHEN 4 THEN 'April'
+ WHEN 5 THEN 'Mai'
+ WHEN 6 THEN 'Juni'
+ WHEN 7 THEN 'Juli'
+ WHEN 8 THEN 'August'
+ WHEN 9 THEN 'September'
+ WHEN 10 THEN 'Oktober'
+ WHEN 11 THEN 'November'
+ WHEN 12 THEN 'Dezember'
+ END, ' ', {$year}) as period_label,
+ SUM(net) as total_net,
+ SUM(tax) as total_tax,
+ SUM(total) as total_gross
+ ")
+ ->where('year', $year)
+ ->where('month', $month)
+ ->where('cancellation', false)
+ ->groupBy(DB::raw('1'))
+ ->get();
+ }
+
+ private function getCreditByMonthsInYear($year)
+ {
+ return UserCredit::selectRaw("
+ year,
+ month,
+ CONCAT(CASE month
+ WHEN 1 THEN 'Januar'
+ WHEN 2 THEN 'Februar'
+ WHEN 3 THEN 'März'
+ WHEN 4 THEN 'April'
+ WHEN 5 THEN 'Mai'
+ WHEN 6 THEN 'Juni'
+ WHEN 7 THEN 'Juli'
+ WHEN 8 THEN 'August'
+ WHEN 9 THEN 'September'
+ WHEN 10 THEN 'Oktober'
+ WHEN 11 THEN 'November'
+ WHEN 12 THEN 'Dezember'
+ END, ' ', year) as period_label,
+ SUM(net) as total_net,
+ SUM(tax) as total_tax,
+ SUM(total) as total_gross
+ ")
+ ->where('year', $year)
+ ->where('cancellation', false)
+ ->groupBy('year', 'month')
+ ->orderBy('month')
+ ->get();
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/SalesController.php b/app/Http/Controllers/SalesController.php
index 6bc8bafb..f58c6671 100755
--- a/app/Http/Controllers/SalesController.php
+++ b/app/Http/Controllers/SalesController.php
@@ -373,14 +373,14 @@ class SalesController extends Controller
if(isset($data['action'])){
if($data['action'] === 'create_invoice'){
$shopping_order = ShoppingOrder::findOrFail($data['id']);
- if($shopping_order->mode === 'live'){
- $invoice_repo = new InvoiceRepository($shopping_order);
- if($shopping_order->isInvoice()){
- $invoice_repo->update($data);
- }else{
- $invoice_repo->createAndSalesVolume($data);
- }
+
+ $invoice_repo = new InvoiceRepository($shopping_order);
+ if($shopping_order->isInvoice()){
+ $invoice_repo->update($data);
+ }else{
+ $invoice_repo->createAndSalesVolume($data);
}
+
if(isset($data['view']) && $data['view'] === 'sales_customer'){
return redirect(route('admin_sales_customers_detail', [$shopping_order->id]));
}
diff --git a/app/Http/Controllers/ShippingController.php b/app/Http/Controllers/ShippingController.php
index e7055292..e49be466 100755
--- a/app/Http/Controllers/ShippingController.php
+++ b/app/Http/Controllers/ShippingController.php
@@ -37,9 +37,11 @@ class ShippingController extends Controller
if($shipping_id === "new"){
$shipping = new Shipping();
$shipping->active = 1;
+ // For new shipping objects, create an empty collection for countries
+ $shipping->setRelation('countries', collect());
}else{
- $shipping = Shipping::findOrFail($shipping_id);
+ $shipping = Shipping::with(['countries.country'])->findOrFail($shipping_id);
}
$data = [
diff --git a/app/Http/Controllers/TaxAdvisorController.php b/app/Http/Controllers/TaxAdvisorController.php
deleted file mode 100644
index 7f607922..00000000
--- a/app/Http/Controllers/TaxAdvisorController.php
+++ /dev/null
@@ -1,153 +0,0 @@
-middleware('admin');
- }
-
- public function index()
- {
-
- $this->setFilterVars();
- $data = [
- 'filter_months' => HTMLHelper::getTransMonths(),
- 'filter_years' => HTMLHelper::getYearRange(2023),
- ];
- return view('admin.payment.taxadvisor', $data);
- }
-
- public function download(){
-
- if(Request::get('action') === "export"){
- $objects = $this->initSearch(false);
- $columns = [];
- $filename = "mivita-absatzmengen-".session('payment_taxadvisor_filter_month').'_'.session('payment_taxadvisor_filter_year')."-export";
- $headers = array(
- '#',
- 'Produkt',
- 'Artikelnummer',
- 'Menge',
-
- );
- if($objects){
- foreach ($objects as $key => $obj){
- $columns[] = array(
- 'id' => $key,
- 'name' => $obj['name'],
- 'number' => $obj['number'],
- 'value' => $obj['value'],
- );
- }
- }
- return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
- }
- }
-
-
- private function setFilterVars(){
-
- if(!session('payment_taxadvisor_filter_month')){
- session(['payment_taxadvisor_filter_month' => intval(date('m'))]);
- }
- if(!session('payment_taxadvisor_filter_year')){
- session(['payment_taxadvisor_filter_year' => intval(date('Y'))]);
- }
-
- if(Request::get('payment_taxadvisor_filter_month')){
- session(['payment_taxadvisor_filter_month' => Request::get('payment_taxadvisor_filter_month')]);
- }
- if(Request::get('payment_taxadvisor_filter_year')){
- session(['payment_taxadvisor_filter_year' => Request::get('payment_taxadvisor_filter_year')]);
- }
- }
-
-
- private function initSearch($returnColl = true)
- {
- $this->setFilterVars();
-
- $date_start = Carbon::parse('01.'.session('payment_taxadvisor_filter_month').'.'.session('payment_taxadvisor_filter_year'))->format('Y-m-d');
- $date_end = Carbon::parse('01.'.session('payment_taxadvisor_filter_month').'.'.session('payment_taxadvisor_filter_year'))->endOfMonth()->format('Y-m-d');
-
- $ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
-
- $objects = [];
- foreach($ShoppingOrders as $ShoppingOrder){
- foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
-
- if($shopping_order_item->product){
- if(isset($objects[$shopping_order_item->product->id])){
- $value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
- $objects[$shopping_order_item->product->id]['value'] = $value;
- }else{
- $objects[$shopping_order_item->product->id] = [
- 'name' => $shopping_order_item->product->name,
- 'number' => $shopping_order_item->product->number,
- 'value' => $shopping_order_item->qty
- ];
- }
-
- }
-
- }
- }
-
- if($returnColl){
- $collection = collect();
-
- foreach($objects as $key => $obj){
- $collection->push([
- 'id' => $key,
- 'name' => $obj['name'],
- 'number' => $obj['number'],
- 'value' => $obj['value'],
- ]);
- }
- return $collection;
- }
- return $objects;
-
-
- }
-
-
- public function datatable(){
-
- $collection = $this->initSearch(true);
-
- /*
- $collect = collect([
- ['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
- ['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
- ['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
- ]);
- */
-
- return \DataTables::of($collection)->toJson();
-
-
-
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/app/Http/Controllers/User/CustomerController.php b/app/Http/Controllers/User/CustomerController.php
index 08eb3f03..b946d01e 100755
--- a/app/Http/Controllers/User/CustomerController.php
+++ b/app/Http/Controllers/User/CustomerController.php
@@ -51,7 +51,6 @@ class CustomerController extends Controller
'shopping_user' => $shopping_user,
'isAdmin' => false,
'isView' => 'customer',
-
];
return view('user.customer.detail', $data);
}
diff --git a/app/Http/Controllers/User/MembershipController.php b/app/Http/Controllers/User/MembershipController.php
index 108f5d3f..40dd1f3a 100755
--- a/app/Http/Controllers/User/MembershipController.php
+++ b/app/Http/Controllers/User/MembershipController.php
@@ -232,6 +232,8 @@ class MembershipController extends Controller
return back();
}
+ \Session()->flash('alert-error', __('msg.error_checkbox_not_confirm'));
+ return back();
}
diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php
index 9e2e059b..c47a89e7 100755
--- a/app/Http/Controllers/User/OrderController.php
+++ b/app/Http/Controllers/User/OrderController.php
@@ -344,6 +344,7 @@ class OrderController extends Controller
*/
private function processUserPayment($user, $identifier, $data, $id, $for)
{
+ Shop::deleteCheckoutInstance();
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => 1, // is first faker shop for buy intern
diff --git a/app/Http/Controllers/User/OrderController_bak.php b/app/Http/Controllers/User/OrderController_bak.php
deleted file mode 100644
index 3323d650..00000000
--- a/app/Http/Controllers/User/OrderController_bak.php
+++ /dev/null
@@ -1,674 +0,0 @@
-middleware('active.account');
- }
-
- public function index()
- {
-
- $data = [
- ];
- return view('user.order.index', $data);
- }
-
- public function detail($id)
- {
- $user = User::find(\Auth::user()->id);
- $shopping_order = ShoppingOrder::findOrFail($id);
- 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 = [
- 'shopping_order' => $shopping_order,
- 'isAdmin' => false,
- ];
- return view('user.order.detail', $data);
- }
-
- public function ordersDatatable(){
-
- $user = User::find(\Auth::user()->id);
- $query = ShoppingOrder::with('shopping_user', 'shopping_payments')->select('shopping_orders.*')->where('auth_user_id', '=', $user->id)->where('txaction', '!=', NULL);
-
- return \DataTables::eloquent($query)
- ->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
- return '';
- })
- ->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
- return $ShoppingOrder->created_at->format("d.m.Y");
- })
- ->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
- return Payment::getShoppingOrderBadge($ShoppingOrder);
- })
- ->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
- return ''.$ShoppingOrder->getFormattedTotalShipping()." €";
- })
- ->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
- return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
- })
- ->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
- if($ShoppingOrder->payment_for === 8){
- return '';
- }
- return ''.$ShoppingOrder->getShippedType().'';
- })
- ->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
- return Payment::getPaymentForBadge($ShoppingOrder);
-
- })
- ->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
- return $ShoppingOrder->isInvoice() ? '
- ' : '-';
- })
- ->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
- return $ShoppingOrder->getLastShoppingPayment('reference');
- })
- ->orderColumn('id', 'id $1')
- ->orderColumn('txaction', 'txaction $1')
- ->orderColumn('shipped', 'shipped $1')
- ->orderColumn('total_shipping', 'total_shipping $1')
- ->orderColumn('payment_for', 'payment_for $1')
-
- ->rawColumns(['id', 'txaction', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
- ->make(true);
- }
-
- /*
- $for = me, ot-member, ot-customer, abo-ot-member, abo-ot-customer, abo-me
- */
-
- public function delivery($for, $id=null)
- {
- $user = User::find(\Auth::user()->id);
- $shopping_user = null;
- $delivery_id = null;
- if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
- $shopping_user = Shop::checkShoppingUser($id, $user);
- $delivery_id = $shopping_user->id;
- if(!Shop::checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
- $country = Shop::getDeliveryCountry($for, $delivery_id);
- \Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
- return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
- }
- if($for === 'abo-ot-customer'){
- //check if user has an Abo
- if(AboHelper::hasAboByEmail($shopping_user->billing_email) && !\Session()->has('custom-error')){
- \Session()->flash('custom-error', __('abo.error_email_has_abo', ['email' => $shopping_user->billing_email]));
- return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
- }
- }
- }
- if(Request::get('action') === 'next'){
- Yard::instance('shopping')->destroy();
- if(strpos(Request::get('switchers-radio-is-for'), 'ot') !== false){
- $delivery_id = $id;
- }
- return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id]));
- }
- $data = [
- 'shopping_user' => $shopping_user,
- 'isAdmin' => false,
- 'isView' => 'customer',
- 'for' => $for,
- 'delivery_id' => $delivery_id,
- ];
- return view('user.order.delivery', $data);
- }
-
- public function list($for, $id=null)
- {
- $user = User::find(\Auth::user()->id);
- if($for === 'abo-me' && AboHelper::userHasAbo($user)){
- abort(403, 'User has an Abo. Cannot order.');
- }
- $shopping_user = null;
- $delivery_id = null;
- if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
- $shopping_user = Shop::checkShoppingUser($id, $user);
- $delivery_id = $shopping_user->id;
- }
- if($for === 'ot-customer' || $for === 'abo-ot-customer'){
- //Liederung an (abo-) ot-customer (Kunden) Zahlung und Rechnung geht an Kunden
- UserService::initCustomerYard($shopping_user, $for);
- }else{
- //Lieferung an user oder (abo-) ot-member (Kunden) rechnung geht an User
- //lieferland und rechnungsland prüfen
- $shipping_country_id = Shop::checkShoppingCountry($for, $id);
- if(!$shipping_country_id){
- $country = Shop::getDeliveryCountry($for, $id);
- \Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
- return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
- }
- UserService::initUserYard($user, $shipping_country_id, $for);
- }
- $data = [
- 'shopping_user' => $shopping_user,
- 'user' => $user,
- 'isAdmin' => false,
- 'isView' => 'customer',
- 'for' => $for,
- 'template' => str_replace('abo-', '', $for),
- 'delivery_id' => $delivery_id,
- 'is_abo' => strpos($for, 'abo') !== false,
- 'comp_products' => Shop::getCompProducts($for),
- ];
- return view('user.order.list', $data);
- }
-
- public function payment($for, $id=null){
- $data = Request::all();
- $user = User::find(Auth::user()->id);
- $rules = array(
- 'shipping_salutation' => 'required',
- 'shipping_firstname'=>'required',
- 'shipping_lastname'=>'required',
- 'shipping_address'=>'required',
- 'shipping_zipcode'=>'required',
- 'shipping_city' => 'required',
- 'shipping_state' => 'required',
- );
- $validator = Validator::make(Request::all(), $rules);
- if ($validator->fails()) {
- return back()->withErrors($validator)->withInput(Request::all());
- }
- //hier prüfen, ob versand etc richtig berechnet wurde
- $this->checkSendYardForPayment($data, $id);
-
- if(Yard::instance('shopping')->getNumComp() > 0){
- if(!isset($data['switchers-comp-product'])){
- $validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
- }else{
- if(!is_array($data['switchers-comp-product'])){
- $validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
- }else{
- if(count($data['switchers-comp-product']) !== Yard::instance('shopping')->getNumComp()){
- $validator->errors()->add('switchers-comp-product', __('mdg.please_select_count_compensation_products', ['count'=>Yard::instance('shopping')->getNumComp()]));
- }
- }
- }
- if ($validator->errors()->count()) {
- return back()->withErrors($validator)->withInput(Request::all());
- }
- }
- do {
- $identifier = Util::getToken();
- } while( ShoppingInstance::where('identifier', $identifier)->count() );
- $data['is_from'] = 'user_order';
- $data['is_for'] = $for;
- $data['is_abo'] = $data['is_abo'] ?? 0;
- $data['abo_interval'] = $data['abo_interval'] ?? 0;
- $data['shopping_user_id'] = $id;
- $data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
- unset($data['quantity']);
- unset($data['_token']);
- $data['mode'] = config('app.mode') === 'test' ? 'test' : 'live';
- if($for === 'ot-customer' || $for === 'abo-ot-customer'){
- $shopping_instance = ShoppingInstance::create([
- 'identifier' => $identifier,
- 'user_shop_id' => $user->shop->id,
- 'payment' => 6, //Berater Shop to Customer Shop
- 'subdomain' => $user->shop->getSubdomain(),
- 'country_id' => Yard::instance('shopping')->getShippingCountryId(),
- 'language' => \App::getLocale(),
- 'amount' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
- 'status' => 0,
- 'shopping_user_id' => $id,
- 'shopping_data' => $data,
- 'back' => url()->previous(),
-
- ]);
- Yard::instance('shopping')->store($identifier);
- $yard_shopping_items = OrderPaymentService::getRestoredYardShoppingItems($shopping_instance);
-
- // send Mail to Customer
- $this->customPaymentSendMail($user, $identifier, $yard_shopping_items, $data);
- UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_customer', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
-
- //eine Abschließen bestellseite für den User + Link zum Kunden Shop + Mail an den Kunden / Berater
- return redirect(route('user_order_my_custom_payment', ['identifier'=>$identifier]));
- }else{
- ShoppingInstance::create([
- 'identifier' => $identifier,
- 'user_shop_id' => 1, //is first faker shop for buy intern
- 'auth_user_id' => Auth::user()->id,
- 'payment' => 2, //Berater Shop
- 'subdomain' => url('/'),
- 'country_id' => Yard::instance('shopping')->getShippingCountryId(),
- 'language' => \App::getLocale(),
- 'amount' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
- 'status' => 0,
- 'shopping_user_id' => $id,
- 'shopping_data' => $data,
- 'back' => url()->previous(),
-
- ]);
- Yard::instance('shopping')->store($identifier);
- $path = route('checkout.checkout_card', ['identifier'=>$identifier]);
- UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
- //$path = str_replace('http', 'https', $path);
- return redirect()->secure($path);
- }
-
- }
-
- private function checkSendYardForPayment($data, $id){
-
- $user = User::find(\Auth::user()->id);
- $shopping_user = null;
- if(strpos($data['shipping_is_for'], 'ot') !== false){
- $shopping_user = Shop::checkShoppingUser($id, $user);
- }
-
- $shipping_country_id = Shop::checkShoppingCountry($data['shipping_is_for'], $id);
- if(!$shipping_country_id){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'no shipping_country_id found | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_country_was_not_found'));
- }
- //must be the same shipping country
- if($shipping_country_id != Yard::instance('shopping')->getShippingCountryId()){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'shipping_country_id is not the same from Yard | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_country_was_not_correctly'));
- }
-
- if($data['shipping_is_for'] !== 'ot-customer'){
- if(Yard::instance('shopping')->shipping_free){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard can by not shipping_free | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shopping_cart_was_shipping_free'));
- }
- }
-
- if($data['shipping_is_for'] === 'ot-customer'){
- if(!$user->shop){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'User has no Shop for an User to Customer order| Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shopping_cart_was_not_user_shop'));
- }
- }
-
- $shipping_price = Shop::getShippingPriceByShippingCountryId($shipping_country_id, Yard::instance('shopping')->weight());
- dump($shipping_price);
- //for other and has weight - check
- if(strpos($data['shipping_is_for'], 'ot') !== false && $data['shipping_is_for'] !== 'ot-customer' && Yard::instance('shopping')->weight() > 0){
- if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is 0 or | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_cost_cannot_be_0'));
- }
- if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
- }
- }
- if(($data['shipping_is_for'] == 'me' || $data['shipping_is_for'] == 'abo-me') && Yard::instance('shopping')->weight() > 0){
- if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is 0 or | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_cost_cannot_be_0'));
- }
- dump(Yard::instance('shopping')->getShippingPrice());
- dump($shipping_price->price_comp);
- dump(Yard::instance('shopping')->getNumComp());
- dump($shipping_price->num_comp);
- dd($data) ;
-
- if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price_comp){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
- }
-
- if(Yard::instance('shopping')->getNumComp() != $shipping_price->num_comp){
- $identifier = 'error-'.time().mt_rand(1000000, 9999999);
- Yard::instance('shopping')->store($identifier);
- $data['user_id'] = Auth::user()->id;
- $data['shopping_user_id'] = $id;
- \App\Services\MyLog::writeLog('payment', 'error', 'Yard num_comp is 0 | Yard identifier: '.$identifier, $data);
- abort(403, __('msg.compensation_products_cannot_be_0'));
- }
-
- }
- }
-
- public function datatable(){
-
-
- if(Request::get('shipping_is_for') === 'me' || Request::get('shipping_is_for') === 'abo-me'){
- $show_on_ids = Request::get('is_abo') ? ['12', '13'] : ['2'];
- $query = Product::with('product_buyings')
- ->select('products.*')->where('products.active', true)
- ->where(function($q) use ($show_on_ids) {
- foreach($show_on_ids as $id) {
- $q->orWhereJsonContains('show_on', $id);
- }
- })
- ->orderByRaw("CASE
- WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
- WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
- ELSE 3 END",
- [$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
- }else{
- $show_on_ids = Request::get('is_abo') ? ['12', '13'] : ['3'];
- $query = Product::select('products.*')
- ->where('active', true)
- ->where(function($q) use ($show_on_ids) {
- foreach($show_on_ids as $id) {
- $q->orWhereJsonContains('show_on', $id);
- }
- })
- ->orderByRaw("CASE
- WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
- WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
- ELSE 3 END",
- [$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
- }
- return \DataTables::eloquent($query)
-
- ->addColumn('product', function (Product $product) {
- $cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
- $qty = isset($cartItem->qty) ? $cartItem->qty : 0;
- $rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
- return ''.$product->getLang('name').'
-
**************************************************************** **/
- function _animate() {
+function _animate() {
+ if (jQuery("body").hasClass("enable-animation")) {
+ var wow = new WOW({
+ boxClass: "wow",
+ animateClass: "animated",
+ offset: 90,
+ mobile: false,
+ live: true,
+ });
- if(jQuery("body").hasClass('enable-animation')) {
-
- var wow = new WOW({
- boxClass: 'wow',
- animateClass: 'animated',
- offset: 90,
- mobile: false,
- live: true
- });
-
- wow.init();
-
- }
-
- // Count To
- jQuery(".countTo").appear(function(){
- var _t = jQuery(this),
- _from = _t.attr('data-from') || 0,
- _speed = _t.attr('data-speed') || 1300,
- _refreshInterval = _t.attr('data-refreshInterval') || 60;
-
-
- _t.countTo({
- from: parseInt(_from),
- to: _t.html(),
- speed: parseInt(_speed),
- refreshInterval: parseInt(_refreshInterval),
- });
-
- });
- }
+ wow.init();
+ }
+ // Count To
+ jQuery(".countTo").appear(function() {
+ var _t = jQuery(this),
+ _from = _t.attr("data-from") || 0,
+ _speed = _t.attr("data-speed") || 1300,
+ _refreshInterval = _t.attr("data-refreshInterval") || 60;
+ _t.countTo({
+ from: parseInt(_from),
+ to: _t.html(),
+ speed: parseInt(_speed),
+ refreshInterval: parseInt(_refreshInterval),
+ });
+ });
+}
/** Onepage Nav
**************************************************************** **/
- function _onepageNav() {
+function _onepageNav() {
+ // Top Navigation
+ var _container1 = jQuery(".nav-onepage");
+ if (_container1.length > 0) {
+ loadScript(plugin_path + "jquery.nav.min.js", function() {
+ jQuery(_container1).onePageNav({
+ currentClass: "active",
+ changeHash: false,
+ scrollSpeed: 750,
+ scrollThreshold: 0.5,
+ filter: ":not(.external)",
+ easing: "easeInOutExpo",
+ });
- // Top Navigation
- var _container1 = jQuery(".nav-onepage");
-
- if(_container1.length > 0) {
-
- loadScript(plugin_path + 'jquery.nav.min.js', function() {
-
- jQuery(_container1).onePageNav({
- currentClass: 'active',
- changeHash: false,
- scrollSpeed: 750,
- scrollThreshold: 0.5,
- filter: ':not(.external)',
- easing: 'easeInOutExpo'
- });
-
- // Close Nav on menu click
- jQuery("#topMain.nav-onepage li>a").bind("click", function() {
- if(window.width < 960) {
- jQuery("button.btn-mobile").trigger('click');
- }
- });
-
- });
-
- }
-
-
- // Bullet Navigation
- var _container2 = jQuery("#nav-bullet");
-
- if(_container2.length > 0) {
-
- loadScript(plugin_path + 'jquery.nav.min.js', function() {
-
- jQuery(_container2).onePageNav({
- currentClass: 'active',
- changeHash: false,
- scrollSpeed: 750,
- scrollThreshold: 0.5,
- filter: ':not(.external)',
- easing: 'easeInOutExpo'
- });
-
- });
-
- }
-
-
- }
+ // Close Nav on menu click
+ jQuery("#topMain.nav-onepage li>a").bind("click", function() {
+ if (window.width < 960) {
+ jQuery("button.btn-mobile").trigger("click");
+ }
+ });
+ });
+ }
+ // Bullet Navigation
+ var _container2 = jQuery("#nav-bullet");
+ if (_container2.length > 0) {
+ loadScript(plugin_path + "jquery.nav.min.js", function() {
+ jQuery(_container2).onePageNav({
+ currentClass: "active",
+ changeHash: false,
+ scrollSpeed: 750,
+ scrollThreshold: 0.5,
+ filter: ":not(.external)",
+ easing: "easeInOutExpo",
+ });
+ });
+ }
+}
/** 03. OWL Carousel
**************************************************************** **/
- function _owl_carousel() {
- var _container = jQuery("div.owl-carousel");
+function _owl_carousel() {
+ var _container = jQuery("div.owl-carousel");
- if(_container.length > 0) {
+ if (_container.length > 0) {
+ loadScript(plugin_path + "owl-carousel/owl.carousel.min.js", function() {
+ _container.each(function() {
+ var slider = jQuery(this);
+ var options = slider.attr("data-plugin-options");
- loadScript(plugin_path + 'owl-carousel/owl.carousel.min.js', function() {
+ // Progress Bar
+ var $opt = eval("(" + options + ")"); // convert text to json
- _container.each(function() {
+ if ($opt.progressBar == "true") {
+ var afterInit = progressBar;
+ } else {
+ var afterInit = false;
+ }
- var slider = jQuery(this);
- var options = slider.attr('data-plugin-options');
+ var defaults = {
+ items: 5,
+ itemsCustom: false,
+ itemsDesktop: [1199, 4],
+ itemsDesktopSmall: [980, 3],
+ itemsTablet: [768, 2],
+ itemsTabletSmall: false,
+ itemsMobile: [479, 1],
+ singleItem: true,
+ itemsScaleUp: false,
- // Progress Bar
- var $opt = eval('(' + options + ')'); // convert text to json
+ slideSpeed: 200,
+ paginationSpeed: 800,
+ rewindSpeed: 1000,
- if($opt.progressBar == 'true') {
- var afterInit = progressBar;
- } else {
- var afterInit = false;
- }
+ autoPlay: false,
+ stopOnHover: false,
- var defaults = {
- items: 5,
- itemsCustom: false,
- itemsDesktop: [1199,4],
- itemsDesktopSmall: [980,3],
- itemsTablet: [768,2],
- itemsTabletSmall: false,
- itemsMobile: [479,1],
- singleItem: true,
- itemsScaleUp: false,
+ navigation: false,
+ navigationText: [
+ '',
+ '',
+ ],
+ rewindNav: true,
+ scrollPerPage: false,
- slideSpeed: 200,
- paginationSpeed: 800,
- rewindSpeed: 1000,
+ pagination: true,
+ paginationNumbers: false,
- autoPlay: false,
- stopOnHover: false,
+ responsive: true,
+ responsiveRefreshRate: 200,
+ responsiveBaseWidth: window,
- navigation: false,
- navigationText: [
- '',
- ''
- ],
- rewindNav: true,
- scrollPerPage: false,
+ baseClass: "owl-carousel",
+ theme: "owl-theme",
- pagination: true,
- paginationNumbers: false,
+ lazyLoad: false,
+ lazyFollow: true,
+ lazyEffect: "fade",
- responsive: true,
- responsiveRefreshRate: 200,
- responsiveBaseWidth: window,
+ autoHeight: false,
- baseClass: "owl-carousel",
- theme: "owl-theme",
+ jsonPath: false,
+ jsonSuccess: false,
- lazyLoad: false,
- lazyFollow: true,
- lazyEffect: "fade",
+ dragBeforeAnimFinish: true,
+ mouseDrag: true,
+ touchDrag: true,
- autoHeight: false,
+ transitionStyle: false,
- jsonPath: false,
- jsonSuccess: false,
+ addClassActive: false,
- dragBeforeAnimFinish: true,
- mouseDrag: true,
- touchDrag: true,
+ beforeUpdate: false,
+ afterUpdate: false,
+ beforeInit: false,
+ afterInit: afterInit,
+ beforeMove: false,
+ afterMove: afterInit == false ? false : moved,
+ afterAction: false,
+ startDragging: false,
+ afterLazyLoad: false,
+ };
- transitionStyle: false,
+ var config = jQuery.extend(
+ {},
+ defaults,
+ options,
+ slider.data("plugin-options")
+ );
+ slider.owlCarousel(config).addClass("owl-carousel-init");
- addClassActive: false,
+ // Progress Bar
+ var elem = jQuery(this);
- beforeUpdate: false,
- afterUpdate: false,
- beforeInit: false,
- afterInit: afterInit,
- beforeMove: false,
- afterMove: (afterInit == false) ? false : moved,
- afterAction: false,
- startDragging: false,
- afterLazyLoad: false
- }
+ //Init progressBar where elem is $("#owl-demo")
+ function progressBar(elem) {
+ $elem = elem;
+ //build progress bar elements
+ buildProgressBar();
+ //start counting
+ start();
+ }
- var config = jQuery.extend({}, defaults, options, slider.data("plugin-options"));
- slider.owlCarousel(config).addClass("owl-carousel-init");
-
+ //create div#progressBar and div#bar then prepend to $("#owl-demo")
+ function buildProgressBar() {
+ $progressBar = jQuery("",
+ "
",
+ "
",
+ "
",
+ "
| {{ __('team.account') }}: | ++ @if($TreeCalcBot->__get('business_user')->active_account) + {{ __('team.active') }} + @else + {{ __('team.not_active') }} + @endif + @if($TreeCalcBot->__get('business_user')->payment_account_date) + {{ __('team.until') }}: {{ formatDate($TreeCalcBot->__get('business_user')->payment_account_date) }} + @endif + (ID: {{ $TreeCalcBot->__get('business_user')->m_account }}) Optimized + | +
| {{ __('team.date') }}: | ++ {{ HTMLHelper::getMonth($data['month']) }} {{ $data['year'] }} | {{ __('team.completed') }}: + @if($TreeCalcBot->__get('business_user')->isSave()) + + @if(Auth::user()->isAdmin()) + + {{ __('Live Berechnung') }} + + @endif + @else + + + @endif + | +
| {{ __('team.career_level') }}: | ++ {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->user_level_name) }} + {{ __('team.KU') }} {{ $TreeCalcBot->__get('business_user')->qual_kp }} / {{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->qual_pp, 0) }} + + | +
| {{ __('team.sponsor') }}: | ++ @if($TreeCalcBot->__get('business_user')->sponsor && $TreeCalcBot->__get('business_user')->sponsor->is_sponsor) + {{ $TreeCalcBot->__get('business_user')->sponsor->first_name }} {{ $TreeCalcBot->__get('business_user')->sponsor->last_name }} | + {{ $TreeCalcBot->__get('business_user')->sponsor->email }} | + {{ $TreeCalcBot->__get('business_user')->sponsor->m_account }} + @else + - + @endif + | +
| {{ __('team.consultant_margin') }}: | ++ {{ $TreeCalcBot->__get('business_user')->margin }} % + | +
| {{ __('team.shop_commission') }}: | ++ {{ $TreeCalcBot->__get('business_user')->margin_shop }} % + | +
| {{ __('team.net_turnover') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_sum) }} € + ({{ __('team.own') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total) }} € | {{ __('team.shop') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_shop) }} €) + | +
| {{ __('team.customer_points') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} {{ __('team.KU') }} + ({{ __('team.own') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_KP_points, 0) }} | {{ __('team.shop') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_shop, 0) }}) + {{ __('team.KU') }} {{ $TreeCalcBot->__get('business_user')->qual_kp }} + @if($TreeCalcBot->__get('business_user')->getRestQualKP() > 0) + + Rest-KU: {{ formatNumber($TreeCalcBot->__get('business_user')->getRestQualKP(), 0) }} + + @endif + | +
| {{ __('team.qualification_points') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->total_qual_pp, 0) }} {{ __('team.TP') }} (+ {{ __('team.volume_KU') }}) + | +
| {{ __('team.qualification_commission') }}: | ++ @if($TreeCalcBot->__get('business_user')->isQualLevel()) + + {{ __('team.KP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_kp'], 0) }} | + {{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->total_qual_pp, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_pp'], 0) }} + | {{ $TreeCalcBot->__get('business_user')->qual_user_level['name'] }} + @endif + | +
| {{ __('team.payline_points') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points, 0) }} {{ __('team.PP') }} + | +
| {{ __('team.qualification_points') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} {{ __('team.PP') }} + + ({{ formatNumber($TreeCalcBot->__get('business_user')->payline_points ?? 0, 0) }} Payline + @if($TreeCalcBot->__get('business_user')->getRestQualKP() > 0) + + {{ formatNumber($TreeCalcBot->__get('business_user')->getRestQualKP(), 0) }} Rest-KU + @endif + ) + + | +
| {{ __('team.current_commission_level') }}: | ++ @if($TreeCalcBot->__get('business_user')->isQualLevel()) + + {{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_kp'], 0) }} | + {{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level['qual_pp'], 0) }} + | {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->qual_user_level['name']) }} + @endif + | +
| {{ __('team.next_commission_level') }}: | ++ + {{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['qual_kp'], 0) }} | + {{ __('team.PP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->qual_user_level_next['qual_pp'], 0) }} + | {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->qual_user_level_next['name']) }} + | +
| @if($TreeCalcBot->__get('business_user')->next_qual_user_level) {{ __('team.qualification') }} @endif {{ __('team.next_career_level') }}: |
+ + @if($TreeCalcBot->__get('business_user')->next_qual_user_level) + + {{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['qual_kp'], 0) }} | + {{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->next_qual_user_level['qual_pp'], 0) }} + | {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->next_qual_user_level['name']) }} + @elseif($TreeCalcBot->__get('business_user')->next_can_user_level) + + {{ __('team.KU') }} {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_points_KP_sum, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['qual_kp'], 0) }} | + {{ __('team.TP') }} {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} / + {{ formatNumber($TreeCalcBot->__get('business_user')->next_can_user_level['qual_pp'], 0) }} + | {{ \App\Services\TranslationHelper::transUserLevelName($TreeCalcBot->__get('business_user')->next_can_user_level['name']) }} + @else + + @endif + | +
| {{ __('team.commission_shop') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->commission_shop_sales) }} € + + ({{ __('team.sales_store_net') }}: {{ formatNumber($TreeCalcBot->__get('business_user')->sales_volume_total_shop) }} € / {{ $TreeCalcBot->__get('business_user')->margin_shop }} %) + | +
| {{ __('team.commission_team') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total) }} € + | +
| {{ __('team.commission_payline') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total) }} € + | +
| {{ __('team.commission_WB') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->commission_growth_total) }} € + | +
| {{ __('team.commission_total') }}: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->getCommissionTotal()) }} € + | +
| Team Points: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->total_pp, 0) }} TP + | +
| Qualifikation Team Points: | ++ {{ formatNumber($TreeCalcBot->__get('business_user')->payline_points_qual_kp, 0) }} TP (+ Volumen KP) + | +
| {{__('tables.line')}} | +{{__('tables.points')}} | +{{__('tables.commission')}} % | +{{__('tables.commission')}} € | +
|---|---|---|---|
|
+
+ @if($line <= $TreeCalcBot->__get('business_user')->getQualLevelPaylines())
+ {{ $line }}. {{ __('team.PP') }}
+ @elseif($TreeCalcBot->__get('business_user')->isQualLevelGrowth($line))
+ {{ $line }}. {{ __('team.WB') }}
+ @else
+ {{ $line }}.
+ @endif
+ |
+ {{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }} | +{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 1) }} % | +{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }} € | +
| {{__('tables.total')}} | +{{ formatNumber($TreeCalcBot->__get('business_user')->total_pp, 0) }} | ++ | {{ formatNumber($TreeCalcBot->__get('business_user')->commission_pp_total, 2) }} € | +
+ Bei der Verarbeitung der optimierten Business-Daten ist ein Fehler aufgetreten. + Dies kann durch große Datenmengen oder Systemauslastung verursacht werden. +
+ +{{ $error }}
+ | {{__('ID') }} | +{{__('Berater-ID') }} | +{{ __('Level') }} | +{{ __('KD') }} | +{{__('Gesamte Points')}} | +{{__('Umsatz netto')}} | +{{__('E-Mail')}} | +{{__('First name')}} | +{{__('Last name')}} | +{{__('Nächster Level')}} | +{{__('Sponsor')}} | +{{__('tables.account')}} | +{{__('bis')}} | +
|---|
| + {{ $otp }} + + | +
|
+ +
|
+
**************************************************************** **/
- function _lazyload() {
- var _container = jQuery('img.lazy');
-
- if(_container.length > 0) {
- loadScript(plugin_path + 'lazyload/jquery.lazyload.min.js', function() {
-
- if(jQuery().lazyload) {
-
- _container.each(function () {
- var _t = jQuery(this),
- _effect = _t.attr('data-effect') || 'fadeIn';
-
- _t.lazyload({
- effect : _effect
- });
- });
-
- }
-
- });
-
- }
-
- }
-
-
+function _lazyload() {
+ var _container = jQuery("img.lazy");
+ if (_container.length > 0) {
+ loadScript(plugin_path + "lazyload/jquery.lazyload.min.js", function() {
+ if (jQuery().lazyload) {
+ _container.each(function() {
+ var _t = jQuery(this),
+ _effect = _t.attr("data-effect") || "fadeIn";
+ _t.lazyload({
+ effect: _effect,
+ });
+ });
+ }
+ });
+ }
+}
/** 13. Misc
**************************************************************** **/
- function _misc() {
-
-
- /** Portfolio Bugfix
- *********************** **/
- if(jQuery("#portfolio").length > 0) {
- jQuery("#portfolio .item-box .owl-carousel").each(function() {
-
- // Fix if has owl-carousel slider!
- jQuery(this).parent().parent().find('.item-box-desc').css({"padding-top":"29px"});
-
- });
- }
-
- /** Masonry
- *********************** **/
- if(jQuery().masonry) {
- jQuery(".masonry").masonry();
- }
-
-
-
- /** Isotope Portfolio
- *********************** **/
- var portfolio_isotope_container = jQuery("#portfolio.portfolio-isotope");
-
- if(portfolio_isotope_container.length > 0) {
- loadScript(plugin_path + 'isotope/isotope.pkgd.min.js', function() {
-
- // Isotope Portfolio
- if(jQuery().isotope) {
-
- var _container = jQuery('#portfolio');
-
- // Calculate Item Width on Fullwidth portfolio
- if(_container.hasClass('portfolio-isotope-2')) {
- _cols = 2;
- } else
- if(_container.hasClass('portfolio-isotope-3')) {
- _cols = 3;
- } else
- if(_container.hasClass('portfolio-isotope-4')) {
- _cols = 4;
- } else
- if(_container.hasClass('portfolio-isotope-5')) {
- _cols = 5;
- } else
- if(_container.hasClass('portfolio-isotope-6')) {
- _cols = 6;
- } else { _cols = 4; }
-
-
-
- function _recalcW() {
- _dw = jQuery(document).width();
-
- if(_container.hasClass('fullwidth')) { // Fullwidth
-
- // _w = jQuery(document).width(); // NOT USED - problems on aside header
- _w = _container.width();
- _wItem = (_w/_cols);
-
- if(_dw < 760) {
- _wItem = (_w/2);
- }
- if(_dw < 480) {
- _wItem = jQuery("#portfolio").width();
- }
-
- // Apply item width
- jQuery("#portfolio>.portfolio-item").css({"width":_wItem});
-
- } else { // Non Fullwidth
-
- _mR = parseInt(jQuery("#portfolio>.portfolio-item").css('margin-right'));
- _w = jQuery("#portfolio").closest('.container').width();
- _wItem = _w / _cols - _mR;
-
- if(_dw < 760) {
- _wItem = (_w/2 - _mR);
- }
- if(_dw < 480) {
- _wItem = _w;
- }
-
- // Apply item & container width
- jQuery("#portfolio.portfolio-isotope").css({"width":_w});
- jQuery("#portfolio>.portfolio-item").css({"width":_wItem});
-
- }
-
- // Resize Flex Slider if exists!
- if(jQuery('.flexslider').length > 0) {
- jQuery('.flexslider').resize();
- }
-
- } _recalcW();
-
-
-
- jQuery(window).on("load", function(){
-
- var _t = setTimeout(function(){
-
- _container.isotope({
- masonry: {},
-
- filter: '*',
- animationOptions: {
- duration: 750,
- easing: 'linear',
- queue: false
- }
- });
-
- jQuery('#portfolio_filter>li>a').bind("click", function(e){
- e.preventDefault();
-
- jQuery('#portfolio_filter>li.active').removeClass('active');
- jQuery(this).parent('li').addClass('active');
-
- var selector = jQuery(this).attr('data-filter');
- _container.isotope({
- filter: selector,
- animationOptions: {
- duration: 750,
- easing: 'linear',
- queue: false
- }
- });
-
- });
-
-
- }, 50 );
-
- setTimeout(function() {
- _container.isotope('layout');
- }, 300);
-
- });
-
-
-
- // On Resize
- jQuery(window).resize(function() {
-
- if(window.afterResizeApp2) {
- clearTimeout(window.afterResizeApp2);
- }
-
- window.afterResizeApp2 = setTimeout(function() {
-
- _recalcW();
-
- setTimeout(function() {
- _container.isotope('layout');
- }, 300);
-
- }, 300);
-
- });
-
-
- }
-
-
- });
- } /** end isotope **/
-
-
-
-
- /** Isotope Blog
- *********************** **/
- var blog_isotope_container = jQuery("#blog.blog-isotope");
-
- if(blog_isotope_container.length > 0) {
- loadScript(plugin_path + 'isotope/isotope.pkgd.min.js', function() {
-
- // Isotope blog
- if(jQuery().isotope) {
-
- var _container = jQuery('#blog');
-
- // Calculate Item Width on Fullwidth Blog
- if(_container.hasClass('blog-isotope-2')) {
- _cols = 2;
- } else
- if(_container.hasClass('blog-isotope-3')) {
- _cols = 3;
- } else
- if(_container.hasClass('blog-isotope-4')) {
- _cols = 4;
- } else { _cols = 4; }
-
-
- function _recalcW() {
- _dw = jQuery(document).width();
-
- if(_container.hasClass('fullwidth')) { // Fullwidth
-
- _w = jQuery(document).width();
- _wItem = (_w/_cols);
-
- if(_dw < 760) {
- _wItem = (_w/2);
- }
- if(_dw < 480) {
- _wItem = jQuery("#blog").width();
- }
-
- // Apply item width
- jQuery("#blog>.blog-post-item").css({"width":_wItem});
-
- } else { // Non Fullwidth
-
- _mR = parseInt(jQuery("#blog>.blog-post-item").css('margin-right'));
- _w = jQuery("#blog").closest('.container').width();
- _wItem = _w / _cols - _mR;
-
- if(_dw < 760) {
- _wItem = (_w/2 - _mR);
- }
- if(_dw < 480) {
- _wItem = _w;
- }
-
- // Apply item & container width
- jQuery("#blog.blog-isotope").css({"width":_w});
- jQuery("#blog>.blog-post-item").css({"width":_wItem});
-
- }
-
- // Resize Flex Slider if exists!
- if(jQuery('.flexslider').length > 0) {
- jQuery('.flexslider').resize();
- }
-
- } _recalcW();
-
-
-
- jQuery(window).on("load", function(){
-
- var _t = setTimeout(function(){
-
- _container.isotope({
- masonry: {},
-
- filter: '*',
- animationOptions: {
- duration: 750,
- easing: 'linear',
- queue: false
- }
- });
-
- jQuery('#blog_filter>li>a').bind("click", function(e){
- e.preventDefault();
-
- jQuery('#blog_filter>li.active').removeClass('active');
- jQuery(this).parent('li').addClass('active');
-
- var selector = jQuery(this).attr('data-filter');
- _container.isotope({
- filter: selector,
- animationOptions: {
- duration: 750,
- easing: 'linear',
- queue: false
- }
- });
-
- });
-
-
- }, 50 );
-
- setTimeout(function() {
- _container.isotope('layout');
- }, 300);
-
- });
-
-
-
- // On Resize
- jQuery(window).resize(function() {
-
- if(window.afterResizeApp2) {
- clearTimeout(window.afterResizeApp2);
- }
-
- window.afterResizeApp2 = setTimeout(function() {
-
- _recalcW();
-
- setTimeout(function() {
- _container.isotope('layout');
- }, 300);
-
- }, 300);
-
- });
-
-
- }
-
-
- });
- } /** end isotope **/
-
-
-
-
- /** Flip Boxes
- *********************** **/
- if(jQuery('.box-flip').length > 0) {
-
- jQuery('.box-flip').each(function() {
- _height1 = jQuery('.box1',this).outerHeight();
- _height2 = jQuery('.box2',this).outerHeight();
-
- if(_height1 >= _height2) {
- _height = _height1;
- } else {
- _height = _height2;
- }
-
- jQuery(this).css({"min-height":_height+"px"});
- jQuery('.box1',this).css({"min-height":_height+"px"});
- jQuery('.box2',this).css({"min-height":_height+"px"});
- });
-
- jQuery('.box-flip').hover(function() {
- jQuery(this).addClass('flip');
- },function(){
- jQuery(this).removeClass('flip');
- });
- }
-
-
-
-
- /** Sticky Side (social icons)
- *********************** **/
- if(jQuery("div.sticky-side").length > 0) {
-
- var _t = jQuery("div.sticky-side");
- _h = _t.height() / 2;
-
- _t.css({"margin-top":"-"+_h+"px"});
- }
-
-
-
-
- /** Increase / Decrease No.
+function _misc() {
+ /** Portfolio Bugfix
+ *********************** **/
+ if (jQuery("#portfolio").length > 0) {
+ jQuery("#portfolio .item-box .owl-carousel").each(function() {
+ // Fix if has owl-carousel slider!
+ jQuery(this)
+ .parent()
+ .parent()
+ .find(".item-box-desc")
+ .css({ "padding-top": "29px" });
+ });
+ }
+
+ /** Masonry
+ *********************** **/
+ if (jQuery().masonry) {
+ jQuery(".masonry").masonry();
+ }
+
+ /** Isotope Portfolio
+ *********************** **/
+ var portfolio_isotope_container = jQuery("#portfolio.portfolio-isotope");
+
+ if (portfolio_isotope_container.length > 0) {
+ loadScript(plugin_path + "isotope/isotope.pkgd.min.js", function() {
+ // Isotope Portfolio
+ if (jQuery().isotope) {
+ var _container = jQuery("#portfolio");
+
+ // Calculate Item Width on Fullwidth portfolio
+ if (_container.hasClass("portfolio-isotope-2")) {
+ _cols = 2;
+ } else if (_container.hasClass("portfolio-isotope-3")) {
+ _cols = 3;
+ } else if (_container.hasClass("portfolio-isotope-4")) {
+ _cols = 4;
+ } else if (_container.hasClass("portfolio-isotope-5")) {
+ _cols = 5;
+ } else if (_container.hasClass("portfolio-isotope-6")) {
+ _cols = 6;
+ } else {
+ _cols = 4;
+ }
+
+ function _recalcW() {
+ _dw = jQuery(document).width();
+
+ if (_container.hasClass("fullwidth")) {
+ // Fullwidth
+
+ // _w = jQuery(document).width(); // NOT USED - problems on aside header
+ _w = _container.width();
+ _wItem = _w / _cols;
+
+ if (_dw < 760) {
+ _wItem = _w / 2;
+ }
+ if (_dw < 480) {
+ _wItem = jQuery("#portfolio").width();
+ }
+
+ // Apply item width
+ jQuery("#portfolio>.portfolio-item").css({ width: _wItem });
+ } else {
+ // Non Fullwidth
+
+ _mR = parseInt(
+ jQuery("#portfolio>.portfolio-item").css("margin-right")
+ );
+ _w = jQuery("#portfolio")
+ .closest(".container")
+ .width();
+ _wItem = _w / _cols - _mR;
+
+ if (_dw < 760) {
+ _wItem = _w / 2 - _mR;
+ }
+ if (_dw < 480) {
+ _wItem = _w;
+ }
+
+ // Apply item & container width
+ jQuery("#portfolio.portfolio-isotope").css({ width: _w });
+ jQuery("#portfolio>.portfolio-item").css({ width: _wItem });
+ }
+
+ // Resize Flex Slider if exists!
+ if (jQuery(".flexslider").length > 0) {
+ jQuery(".flexslider").resize();
+ }
+ }
+ _recalcW();
+
+ jQuery(window).on("load", function() {
+ var _t = setTimeout(function() {
+ _container.isotope({
+ masonry: {},
+
+ filter: "*",
+ animationOptions: {
+ duration: 750,
+ easing: "linear",
+ queue: false,
+ },
+ });
+
+ jQuery("#portfolio_filter>li>a").bind("click", function(e) {
+ e.preventDefault();
+
+ jQuery("#portfolio_filter>li.active").removeClass("active");
+ jQuery(this)
+ .parent("li")
+ .addClass("active");
+
+ var selector = jQuery(this).attr("data-filter");
+ _container.isotope({
+ filter: selector,
+ animationOptions: {
+ duration: 750,
+ easing: "linear",
+ queue: false,
+ },
+ });
+ });
+ }, 50);
+
+ setTimeout(function() {
+ _container.isotope("layout");
+ }, 300);
+ });
+
+ // On Resize
+ jQuery(window).resize(function() {
+ if (window.afterResizeApp2) {
+ clearTimeout(window.afterResizeApp2);
+ }
+
+ window.afterResizeApp2 = setTimeout(function() {
+ _recalcW();
+
+ setTimeout(function() {
+ _container.isotope("layout");
+ }, 300);
+ }, 300);
+ });
+ }
+ });
+ } /** end isotope **/
+
+ /** Isotope Blog
+ *********************** **/
+ var blog_isotope_container = jQuery("#blog.blog-isotope");
+
+ if (blog_isotope_container.length > 0) {
+ loadScript(plugin_path + "isotope/isotope.pkgd.min.js", function() {
+ // Isotope blog
+ if (jQuery().isotope) {
+ var _container = jQuery("#blog");
+
+ // Calculate Item Width on Fullwidth Blog
+ if (_container.hasClass("blog-isotope-2")) {
+ _cols = 2;
+ } else if (_container.hasClass("blog-isotope-3")) {
+ _cols = 3;
+ } else if (_container.hasClass("blog-isotope-4")) {
+ _cols = 4;
+ } else {
+ _cols = 4;
+ }
+
+ function _recalcW() {
+ _dw = jQuery(document).width();
+
+ if (_container.hasClass("fullwidth")) {
+ // Fullwidth
+
+ _w = jQuery(document).width();
+ _wItem = _w / _cols;
+
+ if (_dw < 760) {
+ _wItem = _w / 2;
+ }
+ if (_dw < 480) {
+ _wItem = jQuery("#blog").width();
+ }
+
+ // Apply item width
+ jQuery("#blog>.blog-post-item").css({ width: _wItem });
+ } else {
+ // Non Fullwidth
+
+ _mR = parseInt(jQuery("#blog>.blog-post-item").css("margin-right"));
+ _w = jQuery("#blog")
+ .closest(".container")
+ .width();
+ _wItem = _w / _cols - _mR;
+
+ if (_dw < 760) {
+ _wItem = _w / 2 - _mR;
+ }
+ if (_dw < 480) {
+ _wItem = _w;
+ }
+
+ // Apply item & container width
+ jQuery("#blog.blog-isotope").css({ width: _w });
+ jQuery("#blog>.blog-post-item").css({ width: _wItem });
+ }
+
+ // Resize Flex Slider if exists!
+ if (jQuery(".flexslider").length > 0) {
+ jQuery(".flexslider").resize();
+ }
+ }
+ _recalcW();
+
+ jQuery(window).on("load", function() {
+ var _t = setTimeout(function() {
+ _container.isotope({
+ masonry: {},
+
+ filter: "*",
+ animationOptions: {
+ duration: 750,
+ easing: "linear",
+ queue: false,
+ },
+ });
+
+ jQuery("#blog_filter>li>a").bind("click", function(e) {
+ e.preventDefault();
+
+ jQuery("#blog_filter>li.active").removeClass("active");
+ jQuery(this)
+ .parent("li")
+ .addClass("active");
+
+ var selector = jQuery(this).attr("data-filter");
+ _container.isotope({
+ filter: selector,
+ animationOptions: {
+ duration: 750,
+ easing: "linear",
+ queue: false,
+ },
+ });
+ });
+ }, 50);
+
+ setTimeout(function() {
+ _container.isotope("layout");
+ }, 300);
+ });
+
+ // On Resize
+ jQuery(window).resize(function() {
+ if (window.afterResizeApp2) {
+ clearTimeout(window.afterResizeApp2);
+ }
+
+ window.afterResizeApp2 = setTimeout(function() {
+ _recalcW();
+
+ setTimeout(function() {
+ _container.isotope("layout");
+ }, 300);
+ }, 300);
+ });
+ }
+ });
+ } /** end isotope **/
+
+ /** Flip Boxes
+ *********************** **/
+ if (jQuery(".box-flip").length > 0) {
+ jQuery(".box-flip").each(function() {
+ _height1 = jQuery(".box1", this).outerHeight();
+ _height2 = jQuery(".box2", this).outerHeight();
+
+ if (_height1 >= _height2) {
+ _height = _height1;
+ } else {
+ _height = _height2;
+ }
+
+ jQuery(this).css({ "min-height": _height + "px" });
+ jQuery(".box1", this).css({ "min-height": _height + "px" });
+ jQuery(".box2", this).css({ "min-height": _height + "px" });
+ });
+
+ jQuery(".box-flip").hover(
+ function() {
+ jQuery(this).addClass("flip");
+ },
+ function() {
+ jQuery(this).removeClass("flip");
+ }
+ );
+ }
+
+ /** Sticky Side (social icons)
+ *********************** **/
+ if (jQuery("div.sticky-side").length > 0) {
+ var _t = jQuery("div.sticky-side");
+ _h = _t.height() / 2;
+
+ _t.css({ "margin-top": "-" + _h + "px" });
+ }
+
+ /** Increase / Decrease No.
Example: shop-single-left.html
*********************** **/
- jQuery(".incr").bind("click", function(e) {
- e.preventDefault();
+ jQuery(".incr").bind("click", function(e) {
+ e.preventDefault();
- var _for = jQuery(this).attr('data-for'),
- _max = parseInt(jQuery(this).attr('data-max')),
- _curVal = parseInt(jQuery("#" + _for).val());
+ var _for = jQuery(this).attr("data-for"),
+ _max = parseInt(jQuery(this).attr("data-max")),
+ _curVal = parseInt(jQuery("#" + _for).val());
- if(_curVal < _max) {
- jQuery("#" + _for).val(_curVal + 1);
- }
- });
+ if (_curVal < _max) {
+ jQuery("#" + _for).val(_curVal + 1);
+ }
+ });
- jQuery(".decr").bind("click", function(e) {
- e.preventDefault();
+ jQuery(".decr").bind("click", function(e) {
+ e.preventDefault();
- var _for = jQuery(this).attr('data-for'),
- _min = parseInt(jQuery(this).attr('data-min')),
- _curVal = parseInt(jQuery("#" + _for).val());
+ var _for = jQuery(this).attr("data-for"),
+ _min = parseInt(jQuery(this).attr("data-min")),
+ _curVal = parseInt(jQuery("#" + _for).val());
- if(_curVal > _min) {
- jQuery("#" + _for).val(_curVal - 1);
- }
- });
+ if (_curVal > _min) {
+ jQuery("#" + _for).val(_curVal - 1);
+ }
+ });
+ /** Default Button Toggle
+ *********************** **/
+ jQuery("a.toggle-default").bind("click", function(e) {
+ e.preventDefault();
+ var _href = jQuery(this).attr("href");
+ if (jQuery(_href).is(":hidden")) {
+ jQuery(_href).slideToggle(200);
+ jQuery("i.fa", this)
+ .removeClass("fa-plus-square")
+ .addClass("fa-minus-square");
+ } else {
+ jQuery(_href).slideToggle(200);
+ jQuery("i.fa", this)
+ .removeClass("fa-minus-square")
+ .addClass("fa-plus-square");
+ }
+ });
-
- /** Default Button Toggle
- *********************** **/
- jQuery("a.toggle-default").bind("click", function(e) {
- e.preventDefault();
-
- var _href = jQuery(this).attr('href');
-
- if(jQuery(_href).is(":hidden")) {
-
- jQuery(_href).slideToggle(200);
- jQuery('i.fa', this).removeClass('fa-plus-square').addClass('fa-minus-square');
-
- } else {
-
- jQuery(_href).slideToggle(200);
- jQuery('i.fa', this).removeClass('fa-minus-square').addClass('fa-plus-square');
-
- }
-
- });
-
-
-
-
-
- /** Custom File Upload
+ /** Custom File Upload
*********************** **/
- var file_container = jQuery("input[type=file]");
+ var file_container = jQuery("input[type=file]");
- if(file_container.length > 0) {
- loadScript(plugin_path + 'custom.fle_upload.js');
- }
+ if (file_container.length > 0) {
+ loadScript(plugin_path + "custom.fle_upload.js");
+ }
+ /** Textarea Words Limit
+ *********************** **/
+ jQuery("textarea.word-count").on("keyup", function() {
+ var _t = jQuery(this),
+ words = this.value.match(/\S+/g).length,
+ _limit = _t.attr("data-maxlength") || 200;
+ if (words > parseInt(_limit)) {
+ // Split the string on first 200 words and rejoin on spaces
+ var trimmed = _t
+ .val()
+ .split(/\s+/, 200)
+ .join(" ");
+ // Add a space at the end to keep new typing making new words
+ _t.val(trimmed + " ");
+ } else {
+ var _data_info = _t.attr("data-info");
- /** Textarea Words Limit
- *********************** **/
- jQuery("textarea.word-count").on('keyup', function() {
- var _t = jQuery(this),
- words = this.value.match(/\S+/g).length,
- _limit = _t.attr('data-maxlength') || 200;
-
- if (words > parseInt(_limit)) {
-
- // Split the string on first 200 words and rejoin on spaces
- var trimmed = _t.val().split(/\s+/, 200).join(" ");
- // Add a space at the end to keep new typing making new words
- _t.val(trimmed + " ");
-
- } else {
-
- var _data_info = _t.attr('data-info');
-
- if(_data_info == '' || _data_info == undefined) {
- var _infoContainer = _t.next('div');
- jQuery('span', _infoContainer).text(words + '/' + _limit);
- } else {
- jQuery('#' +_data_info).text(words + '/' + _limit);
- }
-
-
- }
- });
-
- }
-
-
+ if (_data_info == "" || _data_info == undefined) {
+ var _infoContainer = _t.next("div");
+ jQuery("span", _infoContainer).text(words + "/" + _limit);
+ } else {
+ jQuery("#" + _data_info).text(words + "/" + _limit);
+ }
+ }
+ });
+}
/** Sticky Footer
**************************************************************** **/
- function _stickyFooter() {
- if(jQuery("#footer").hasClass('sticky')) {
-
- var footerHeight = 0,
- footerTop = 0,
- _footer = jQuery("#footer.sticky");
-
- positionFooter();
-
- function positionFooter() {
- footerHeight = _footer.height();
- footerTop = (jQuery(window).scrollTop()+jQuery(window).height()-footerHeight)+"px";
-
- if((jQuery(document.body).height()+footerHeight) > jQuery(window).height()) {
- _footer.css({
- position: "absolute"
- }).stop().animate({
- top: footerTop
- },0);
- } else {
- _footer.css({position: "static"});
- }
-
- }
-
- jQuery(window).scroll(positionFooter).resize(positionFooter);
-
- }
- }
+function _stickyFooter() {
+ if (jQuery("#footer").hasClass("sticky")) {
+ var footerHeight = 0,
+ footerTop = 0,
+ _footer = jQuery("#footer.sticky");
+ positionFooter();
+ function positionFooter() {
+ footerHeight = _footer.height();
+ footerTop =
+ jQuery(window).scrollTop() +
+ jQuery(window).height() -
+ footerHeight +
+ "px";
+ if (
+ jQuery(document.body).height() + footerHeight >
+ jQuery(window).height()
+ ) {
+ _footer
+ .css({
+ position: "absolute",
+ })
+ .stop()
+ .animate(
+ {
+ top: footerTop,
+ },
+ 0
+ );
+ } else {
+ _footer.css({ position: "static" });
+ }
+ }
+ jQuery(window)
+ .scroll(positionFooter)
+ .resize(positionFooter);
+ }
+}
/** Countdown
**************************************************************** **/
- function _countDown() {
- var _container = jQuery(".countdown"),
- _container2 = jQuery(".countdown-download");
-
- if(_container.length > 0 || _container2.length > 0) {
+function _countDown() {
+ var _container = jQuery(".countdown"),
+ _container2 = jQuery(".countdown-download");
- loadScript(plugin_path + 'countdown/jquery.countdown.pack.min.js', function() {
+ if (_container.length > 0 || _container2.length > 0) {
+ loadScript(
+ plugin_path + "countdown/jquery.countdown.pack.min.js",
+ function() {
+ /** On Page Load **/
+ _container.each(function() {
+ var _t = jQuery(this),
+ _date = _t.attr("data-from"),
+ _labels = _t.attr("data-labels");
- /** On Page Load **/
- _container.each(function() {
- var _t = jQuery(this),
- _date = _t.attr('data-from'),
- _labels = _t.attr('data-labels');
+ if (_labels) {
+ _labels = _labels.split(",");
+ }
- if(_labels) {
- _labels = _labels.split(",");
- }
+ if (_date) {
+ var _d = new Date(_date);
+ jQuery(this).countdown({
+ until: new Date(_d),
+ labels: _labels || [
+ "Years",
+ "Months",
+ "Weeks",
+ "Days",
+ "Hours",
+ "Minutes",
+ "Seconds",
+ ],
+ });
+ }
+ });
- if(_date) {
- var _d = new Date(_date);
- jQuery(this).countdown({
- until: new Date(_d),
- labels: _labels || ["Years","Months","Weeks","Days","Hours","Minutes","Seconds"]
- });
- }
- });
+ /** Download **/
+ _container2.bind("click", function(e) {
+ e.preventDefault();
+ var _t = jQuery(this),
+ cd_container = _t.attr("data-for"),
+ _countdown = jQuery(
+ "#" + cd_container + " span.download-wait>.countdown"
+ ),
+ _seconds = parseInt(_t.attr("data-seconds")),
+ _dataURL = _t.attr("href");
- /** Download **/
- _container2.bind("click", function(e){
- e.preventDefault();
-
- var _t = jQuery(this),
- cd_container = _t.attr('data-for'),
- _countdown = jQuery("#"+cd_container+' span.download-wait>.countdown'),
- _seconds = parseInt(_t.attr('data-seconds')),
- _dataURL = _t.attr('href');
-
- _t.fadeOut(250, function(){
- jQuery("#"+cd_container).fadeIn(250, function() {
-
- var currentDate = new Date();
- currentDate.setSeconds(currentDate.getSeconds() + _seconds);
-
- _countdown.countdown({
- until: currentDate,
- format: 'S',
- expiryUrl: _dataURL,
- onExpiry: function(){
- jQuery("#"+cd_container+' span.download-message').removeClass('hide');
- jQuery("#"+cd_container+' span.download-wait').addClass('hide');
- }
- });
-
- });
- });
-
- return false;
-
- });
-
-
- });
-
- }
-
- }
+ _t.fadeOut(250, function() {
+ jQuery("#" + cd_container).fadeIn(250, function() {
+ var currentDate = new Date();
+ currentDate.setSeconds(currentDate.getSeconds() + _seconds);
+ _countdown.countdown({
+ until: currentDate,
+ format: "S",
+ expiryUrl: _dataURL,
+ onExpiry: function() {
+ jQuery(
+ "#" + cd_container + " span.download-message"
+ ).removeClass("hide");
+ jQuery("#" + cd_container + " span.download-wait").addClass(
+ "hide"
+ );
+ },
+ });
+ });
+ });
+ return false;
+ });
+ }
+ );
+ }
+}
/** Masonry Gallery
**************************************************************** **/
- function _masonryGallery() {
+function _masonryGallery() {
+ if (jQuery(".masonry-gallery").length > 0) {
+ jQuery(".masonry-gallery").each(function() {
+ var _container = jQuery(this),
+ columns = 4;
- if(jQuery(".masonry-gallery").length > 0) {
+ if (_container.hasClass("columns-2")) columns = 2;
+ else if (_container.hasClass("columns-3")) columns = 3;
+ else if (_container.hasClass("columns-4")) columns = 4;
+ else if (_container.hasClass("columns-5")) columns = 5;
+ else if (_container.hasClass("columns-6")) columns = 6;
- jQuery(".masonry-gallery").each(function() {
- var _container = jQuery(this),
- columns = 4;
+ var _firstElemWidth = _container.find("a:eq(0)").outerWidth(),
+ _bigImageNo = _container.attr("data-img-big"),
+ _containerWidth = _container.width();
- if(_container.hasClass('columns-2')) columns = 2;
- else if(_container.hasClass('columns-3')) columns = 3;
- else if(_container.hasClass('columns-4')) columns = 4;
- else if(_container.hasClass('columns-5')) columns = 5;
- else if(_container.hasClass('columns-6')) columns = 6;
+ // Fix margins & Width
+ var postWidth = _containerWidth / columns;
+ postWidth = Math.floor(postWidth);
+ if (postWidth * columns >= _containerWidth) {
+ _container.css({ "margin-right": "-1px" });
+ }
+ if (columns < 6) {
+ _container.children("a").css({ width: postWidth + "px" });
+ }
- var _firstElemWidth = _container.find('a:eq(0)').outerWidth(),
- _bigImageNo = _container.attr('data-img-big'),
- _containerWidth = _container.width();
+ // Set Big Image
+ if (parseInt(_bigImageNo) > 0) {
+ _bigImageNo = Number(_bigImageNo) - 1;
+ _container
+ .find("a:eq(" + _bigImageNo + ")")
+ .css({ width: _firstElemWidth * 2 + "px" });
+ loadScript(plugin_path + "isotope/isotope.pkgd.min.js", function() {
+ setTimeout(function() {
+ _container.isotope({
+ masonry: {
+ columnWidth: _firstElemWidth,
+ },
+ });
- // Fix margins & Width
- var postWidth = (_containerWidth/columns);
- postWidth = Math.floor(postWidth);
- if((postWidth * columns) >= _containerWidth) {
- _container.css({ 'margin-right': '-1px' });
- }
- if(columns < 6) {
- _container.children('a').css({"width":postWidth+"px"});
- }
+ _container.isotope("layout");
+ }, 1000);
+ });
+ }
+ });
+ }
+}
-
- // Set Big Image
- if(parseInt(_bigImageNo) > 0) {
-
- _bigImageNo = Number(_bigImageNo) - 1;
- _container.find('a:eq('+_bigImageNo+')').css({ width: _firstElemWidth*2 + 'px'});
-
- loadScript(plugin_path + 'isotope/isotope.pkgd.min.js', function() {
-
- setTimeout( function() {
- _container.isotope({
- masonry: {
- columnWidth: _firstElemWidth
- }
- });
-
- _container.isotope('layout');
-
- }, 1000);
-
- });
-
- }
-
- });
-
-
- }
-
- }
-
-
-
-
/** Toastr
TYPE:
@@ -2697,573 +2464,611 @@
NOTE:
_onclick = url to redirect (example: http://www.stepofweb.com)
**************************************************************** **/
- function _toastr(_message,_position,_notifyType,_onclick) {
- var _btn = jQuery(".toastr-notify");
+function _toastr(_message, _position, _notifyType, _onclick) {
+ var _btn = jQuery(".toastr-notify");
- if(_btn.length > 0 && _message != false) {
+ if (_btn.length > 0 && _message != false) {
+ loadScript(plugin_path + "toastr/toastr.js", function() {
+ // toastr.clear();
- loadScript(plugin_path + 'toastr/toastr.js', function() {
- // toastr.clear();
+ /** BUTTON CLICK
+ ********************* **/
+ _btn.bind("click", function(e) {
+ e.preventDefault();
- /** BUTTON CLICK
- ********************* **/
- _btn.bind("click", function(e) {
- e.preventDefault();
+ var _message = jQuery(this).attr("data-message"),
+ _notifyType = jQuery(this).attr("data-notifyType") || "default",
+ _position = jQuery(this).attr("data-position") || "top-right",
+ _progressBar =
+ jQuery(this).attr("data-progressBar") == "true" ? true : false,
+ _closeButton =
+ jQuery(this).attr("data-closeButton") == "true" ? true : false,
+ _debug = jQuery(this).attr("data-debug") == "true" ? true : false,
+ _newestOnTop =
+ jQuery(this).attr("data-newestOnTop") == "true" ? true : false,
+ _preventDuplicates =
+ jQuery(this).attr("data-preventDuplicates") == "true"
+ ? true
+ : false,
+ _showDuration = jQuery(this).attr("data-showDuration") || "300",
+ _hideDuration = jQuery(this).attr("data-hideDuration") || "1000",
+ _timeOut = jQuery(this).attr("data-timeOut") || "5000",
+ _extendedTimeOut =
+ jQuery(this).attr("data-extendedTimeOut") || "1000",
+ _showEasing = jQuery(this).attr("data-showEasing") || "swing",
+ _hideEasing = jQuery(this).attr("data-hideEasing") || "linear",
+ _showMethod = jQuery(this).attr("data-showMethod") || "fadeIn",
+ _hideMethod = jQuery(this).attr("data-hideMethod") || "fadeOut";
+ toastr.options = {
+ closeButton: _closeButton,
+ debug: _debug,
+ newestOnTop: _newestOnTop,
+ progressBar: _progressBar,
+ positionClass: "toast-" + _position,
+ preventDuplicates: _preventDuplicates,
+ onclick: null,
+ showDuration: _showDuration,
+ hideDuration: _hideDuration,
+ timeOut: _timeOut,
+ extendedTimeOut: _extendedTimeOut,
+ showEasing: _showEasing,
+ hideEasing: _hideEasing,
+ showMethod: _showMethod,
+ hideMethod: _hideMethod,
+ };
- var _message = jQuery(this).attr('data-message'),
- _notifyType = jQuery(this).attr('data-notifyType') || "default",
- _position = jQuery(this).attr('data-position') || "top-right",
- _progressBar = jQuery(this).attr('data-progressBar') == "true" ? true : false,
- _closeButton = jQuery(this).attr('data-closeButton') == "true" ? true : false,
- _debug = jQuery(this).attr('data-debug') == "true" ? true : false,
- _newestOnTop = jQuery(this).attr('data-newestOnTop') == "true" ? true : false,
- _preventDuplicates = jQuery(this).attr('data-preventDuplicates') == "true" ? true : false,
- _showDuration = jQuery(this).attr('data-showDuration') || "300",
- _hideDuration = jQuery(this).attr('data-hideDuration') || "1000",
- _timeOut = jQuery(this).attr('data-timeOut') || "5000",
- _extendedTimeOut = jQuery(this).attr('data-extendedTimeOut') || "1000",
- _showEasing = jQuery(this).attr('data-showEasing') || "swing",
- _hideEasing = jQuery(this).attr('data-hideEasing') || "linear",
- _showMethod = jQuery(this).attr('data-showMethod') || "fadeIn",
- _hideMethod = jQuery(this).attr('data-hideMethod') || "fadeOut";
+ toastr[_notifyType](_message);
+ });
- toastr.options = {
- "closeButton": _closeButton,
- "debug": _debug,
- "newestOnTop": _newestOnTop,
- "progressBar": _progressBar,
- "positionClass": "toast-" + _position,
- "preventDuplicates": _preventDuplicates,
- "onclick": null,
- "showDuration": _showDuration,
- "hideDuration": _hideDuration,
- "timeOut": _timeOut,
- "extendedTimeOut": _extendedTimeOut,
- "showEasing": _showEasing,
- "hideEasing": _hideEasing,
- "showMethod": _showMethod,
- "hideMethod": _hideMethod
- }
+ /** JAVSCRIPT / ON LOAD
+ ************************* **/
+ if (_message != false) {
+ if (_onclick != false) {
+ onclick = function() {
+ window.location = _onclick;
+ };
+ } else {
+ onclick = null;
+ }
- toastr[_notifyType](_message);
- });
-
-
- /** JAVSCRIPT / ON LOAD
- ************************* **/
- if(_message != false) {
-
- if(_onclick != false) {
- onclick = function() {
- window.location = _onclick;
- }
- } else {
- onclick = null
- }
-
- toastr.options = {
- "closeButton": true,
- "debug": false,
- "newestOnTop": false,
- "progressBar": true,
- "positionClass": "toast-" + _position,
- "preventDuplicates": false,
- "onclick": onclick,
- "showDuration": "300",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": "fadeIn",
- "hideMethod": "fadeOut"
- }
-
- setTimeout(function(){
- toastr[_notifyType](_message);
- }, 1500); // delay 1.5s
- }
- });
-
- }
-
- }
+ toastr.options = {
+ closeButton: true,
+ debug: false,
+ newestOnTop: false,
+ progressBar: true,
+ positionClass: "toast-" + _position,
+ preventDuplicates: false,
+ onclick: onclick,
+ showDuration: "300",
+ hideDuration: "1000",
+ timeOut: "5000",
+ extendedTimeOut: "1000",
+ showEasing: "swing",
+ hideEasing: "linear",
+ showMethod: "fadeIn",
+ hideMethod: "fadeOut",
+ };
+ setTimeout(function() {
+ toastr[_notifyType](_message);
+ }, 1500); // delay 1.5s
+ }
+ });
+ }
+}
/** Chart
**************************************************************** **/
- function _charts() {
+function _charts() {
+ /** Easy Pie Chart
+ ************************* **/
+ var _container = jQuery(".piechart");
- /** Easy Pie Chart
- ************************* **/
- var _container = jQuery(".piechart");
-
- if(_container.length > 0) {
-
- loadScript(plugin_path + 'chart.easypiechart/dist/jquery.easypiechart.min.js', function() {
-
- jQuery(".piechart").each(function() {
- var _t = jQuery(this),
- _size = _t.attr('data-size') || 150,
- _animate = _t.attr('data-animate') || "3000";
-
- _t.easyPieChart({
- size: _size,
- animate: _animate,
- scaleColor: false,
- trackColor: _t.attr('data-trackcolor') || 'rgba(0,0,0,0.04)',
- lineWidth: _t.attr('data-width') || '2',
- lineCap: 'square',
- barColor: _t.attr('data-color') || '#0093BF'
- });
-
- /* fix element positioning */
- jQuery("*", this).attr('style', "line-height:"+_size+"px !important; height:"+_size+"px !important; width:"+_size+"px !important");
-
- });
-
- });
-
- }
-
-
- }
+ if (_container.length > 0) {
+ loadScript(
+ plugin_path + "chart.easypiechart/dist/jquery.easypiechart.min.js",
+ function() {
+ jQuery(".piechart").each(function() {
+ var _t = jQuery(this),
+ _size = _t.attr("data-size") || 150,
+ _animate = _t.attr("data-animate") || "3000";
+ _t.easyPieChart({
+ size: _size,
+ animate: _animate,
+ scaleColor: false,
+ trackColor: _t.attr("data-trackcolor") || "rgba(0,0,0,0.04)",
+ lineWidth: _t.attr("data-width") || "2",
+ lineCap: "square",
+ barColor: _t.attr("data-color") || "#0093BF",
+ });
+ /* fix element positioning */
+ jQuery("*", this).attr(
+ "style",
+ "line-height:" +
+ _size +
+ "px !important; height:" +
+ _size +
+ "px !important; width:" +
+ _size +
+ "px !important"
+ );
+ });
+ }
+ );
+ }
+}
/** Select2
**************************************************************** **/
- function _select2() {
- var _container = jQuery('select.select2');
-
- if(_container.length > 0) {
-
- loadScript(plugin_path + 'select2/js/select2.full.min.js', function() {
-
- _container.each(function() {
- var _t = jQuery(this);
-
- if(!_t.hasClass('select2-custom')) {
- _t.select2();
- }
-
- })
-
- });
- }
-
- }
-
+function _select2() {
+ var _container = jQuery("select.select2");
+ if (_container.length > 0) {
+ loadScript(plugin_path + "select2/js/select2.full.min.js", function() {
+ _container.each(function() {
+ var _t = jQuery(this);
+ if (!_t.hasClass("select2-custom")) {
+ _t.select2();
+ }
+ });
+ });
+ }
+}
/** Form [form plugin + validation plugin]
**************************************************************** **/
- function _form() {
-
-
- /** Form Validate
+function _form() {
+ /** Form Validate
LOAD PLUGIN ONLY!
************************ **/
- if(jQuery('form.validate-plugin').length > 0) {
+ if (jQuery("form.validate-plugin").length > 0) {
+ loadScript(plugin_path + "form.validate/jquery.form.min.js", function() {
+ loadScript(plugin_path + "form.validate/jquery.validation.min.js");
+ });
+ }
- loadScript(plugin_path + 'form.validate/jquery.form.min.js', function() {
- loadScript(plugin_path + 'form.validate/jquery.validation.min.js');
- });
+ /** Form Validate
+ ************************ **/
+ if (jQuery("form.validate").length > 0) {
+ loadScript(plugin_path + "form.validate/jquery.form.min.js", function() {
+ loadScript(
+ plugin_path + "form.validate/jquery.validation.min.js",
+ function() {
+ if (jQuery().validate) {
+ jQuery("form.validate").each(function() {
+ var _t = jQuery(this),
+ _Smessage =
+ _t.attr("data-success") || "Successfully! Thank you!",
+ _Cmessage = _t.attr("data-captcha") || "Invalid Captcha!",
+ _Tposition = _t.attr("data-toastr-position") || "top-right",
+ _Ttype = _t.attr("data-toastr-type") || "success";
+ _Turl = _t.attr("data-toastr-url") || false;
- }
+ // Append 'is_ajax' hidden input field!
+ _t.append('');
+ _t.validate({
+ submitHandler: function(form) {
+ // Show spin icon
+ jQuery(form)
+ .find(".input-group-addon")
+ .find(".fa-envelope")
+ .removeClass("fa-envelope")
+ .addClass("fa-refresh fa-spin");
+ jQuery(form).ajaxSubmit({
+ target:
+ jQuery(form).find(".validate-result").length > 0
+ ? jQuery(form).find(".validate-result")
+ : "",
- /** Form Validate
- ************************ **/
- if(jQuery('form.validate').length > 0) {
+ error: function(data) {
+ _toastr("Sent Failed!", _Tposition, "error", false);
+ },
- loadScript(plugin_path + 'form.validate/jquery.form.min.js', function() {
- loadScript(plugin_path + 'form.validate/jquery.validation.min.js', function() {
+ success: function(data) {
+ var data = data.trim();
- if(jQuery().validate) {
+ // SMTP ERROR
+ if (data == "_failed_") {
+ _toastr(
+ "SMTP ERROR! Please, check your config file!",
+ _Tposition,
+ "error",
+ false
+ );
+ }
- jQuery('form.validate').each(function() {
+ // CAPTCHA ERROR
+ else if (data == "_captcha_") {
+ _toastr("Invalid Captcha!", _Tposition, "error", false);
- var _t = jQuery(this),
- _Smessage = _t.attr('data-success') || "Successfully! Thank you!",
- _Cmessage = _t.attr('data-captcha') || "Invalid Captcha!",
- _Tposition = _t.attr('data-toastr-position') || "top-right",
- _Ttype = _t.attr('data-toastr-type') || "success";
- _Turl = _t.attr('data-toastr-url') || false;
-
- // Append 'is_ajax' hidden input field!
- _t.append('');
-
- _t.validate({
- submitHandler: function(form) {
-
- // Show spin icon
- jQuery(form).find('.input-group-addon').find('.fa-envelope').removeClass('fa-envelope').addClass('fa-refresh fa-spin');
-
- jQuery(form).ajaxSubmit({
-
- target: jQuery(form).find('.validate-result').length > 0 ? jQuery(form).find('.validate-result') : '',
-
- error: function(data) {
- _toastr("Sent Failed!",_Tposition,"error",false);
- },
-
- success: function(data) {
- var data = data.trim();
-
- // SMTP ERROR
- if(data == '_failed_') {
- _toastr("SMTP ERROR! Please, check your config file!",_Tposition,"error",false);
- }
-
- // CAPTCHA ERROR
- else if(data == '_captcha_') {
- _toastr("Invalid Captcha!",_Tposition,"error",false);
-
-
- // SUCCESS
- } else {
-
- // Remove spin icon
- jQuery(form).find('.input-group-addon').find('.fa-refresh').removeClass('fa-refresh fa-spin').addClass('fa-envelope');
-
- // Clear the form
- jQuery(form).find('input.form-control').val('');
-
- // Toastr Message
- _toastr(_Smessage,_Tposition,_Ttype,_Turl);
-
- }
- }
- });
-
- }
- });
-
- });
-
- }
-
- });
- });
-
- }
-
-
-
-
- /** Masked Input
- ************************ **/
- var _container = jQuery('input.masked');
- if(_container.length > 0) {
-
- loadScript(plugin_path + 'form.masked/jquery.maskedinput.js', function() {
-
- _container.each(function() {
-
- var _t = jQuery(this);
- _format = _t.attr('data-format') || '(999) 999-999999',
- _placeholder = _t.attr('data-placeholder') || 'X';
-
- jQuery.mask.definitions['f'] = "[A-Fa-f0-9]";
- _t.mask(_format, {placeholder:_placeholder});
-
- });
-
- });
-
- }
-
- }
+ // SUCCESS
+ } else {
+ // Remove spin icon
+ jQuery(form)
+ .find(".input-group-addon")
+ .find(".fa-refresh")
+ .removeClass("fa-refresh fa-spin")
+ .addClass("fa-envelope");
+ // Clear the form
+ jQuery(form)
+ .find("input.form-control")
+ .val("");
+ // Toastr Message
+ _toastr(_Smessage, _Tposition, _Ttype, _Turl);
+ }
+ },
+ });
+ },
+ });
+ });
+ }
+ }
+ );
+ });
+ }
+ /** Masked Input
+ ************************ **/
+ var _container = jQuery("input.masked");
+ if (_container.length > 0) {
+ loadScript(plugin_path + "form.masked/jquery.maskedinput.js", function() {
+ _container.each(function() {
+ var _t = jQuery(this);
+ (_format = _t.attr("data-format") || "(999) 999-999999"),
+ (_placeholder = _t.attr("data-placeholder") || "X");
+ jQuery.mask.definitions["f"] = "[A-Fa-f0-9]";
+ _t.mask(_format, { placeholder: _placeholder });
+ });
+ });
+ }
+}
/** Pickers
**************************************************************** **/
- function _pickers() {
-
- /** Date Picker
+function _pickers() {
+ /** Date Picker
******************* **/
- var _container_1 = jQuery('.datepicker');
-
- if(_container_1.length > 0) {
- loadScript(plugin_path + 'bootstrap.datepicker/js/bootstrap-datepicker.min.js', function() {
-
- if(jQuery().datepicker) {
+ var _container_1 = jQuery(".datepicker");
- _container_1.each(function() {
- var _t = jQuery(this),
- _lang = _t.attr('data-lang') || 'en';
+ if (_container_1.length > 0) {
+ loadScript(
+ plugin_path + "bootstrap.datepicker/js/bootstrap-datepicker.min.js",
+ function() {
+ if (jQuery().datepicker) {
+ _container_1.each(function() {
+ var _t = jQuery(this),
+ _lang = _t.attr("data-lang") || "en";
- if(_lang != 'en' && _lang != '') { // load language file
- loadScript(plugin_path + 'bootstrap.datepicker/locales/bootstrap-datepicker.'+_lang+'.min.js');
- }
+ if (_lang != "en" && _lang != "") {
+ // load language file
+ loadScript(
+ plugin_path +
+ "bootstrap.datepicker/locales/bootstrap-datepicker." +
+ _lang +
+ ".min.js"
+ );
+ }
- jQuery(this).datepicker({
- format: _t.attr('data-format') || 'yyyy-mm-dd',
- language: _lang,
- rtl: _t.attr('data-RTL') == "true" ? true : false,
- changeMonth: _t.attr('data-changeMonth') == "false" ? false : true,
- todayBtn: _t.attr('data-todayBtn') == "false" ? false : "linked",
- calendarWeeks: _t.attr('data-calendarWeeks') == "false" ? false : true,
- autoclose: _t.attr('data-autoclose') == "false" ? false : true,
- todayHighlight: _t.attr('data-todayHighlight') == "false" ? false : true,
+ jQuery(this)
+ .datepicker({
+ format: _t.attr("data-format") || "yyyy-mm-dd",
+ language: _lang,
+ rtl: _t.attr("data-RTL") == "true" ? true : false,
+ changeMonth:
+ _t.attr("data-changeMonth") == "false" ? false : true,
+ todayBtn:
+ _t.attr("data-todayBtn") == "false" ? false : "linked",
+ calendarWeeks:
+ _t.attr("data-calendarWeeks") == "false" ? false : true,
+ autoclose: _t.attr("data-autoclose") == "false" ? false : true,
+ todayHighlight:
+ _t.attr("data-todayHighlight") == "false" ? false : true,
- onRender: function(date) {
- // return date.valueOf() < nowDate.valueOf() ? 'disabled' : '';
- }
- }).on('changeDate', function(ev) {
+ onRender: function(date) {
+ // return date.valueOf() < nowDate.valueOf() ? 'disabled' : '';
+ },
+ })
+ .on("changeDate", function(ev) {
+ // AJAX POST - OPTIONAL
+ })
+ .data("datepicker");
+ });
+ }
+ }
+ );
+ }
- // AJAX POST - OPTIONAL
-
- }).data('datepicker');
- });
-
- }
-
- });
- }
-
-
-
-
- /** Range Picker
+ /** Range Picker
******************* **/
- var _container_2 = jQuery('.rangepicker');
-
- if(_container_2.length > 0) {
- loadScript(plugin_path + 'bootstrap.daterangepicker/moment.min.js', function() {
- loadScript(plugin_path + 'bootstrap.daterangepicker/daterangepicker.js', function() {
-
- if(jQuery().datepicker) {
+ var _container_2 = jQuery(".rangepicker");
- _container_2.each(function() {
-
- var _t = jQuery(this),
- _format = _t.attr('data-format').toUpperCase() || 'YYYY-MM-DD';
+ if (_container_2.length > 0) {
+ loadScript(
+ plugin_path + "bootstrap.daterangepicker/moment.min.js",
+ function() {
+ loadScript(
+ plugin_path + "bootstrap.daterangepicker/daterangepicker.js",
+ function() {
+ if (jQuery().datepicker) {
+ _container_2.each(function() {
+ var _t = jQuery(this),
+ _format =
+ _t.attr("data-format").toUpperCase() || "YYYY-MM-DD";
- _t.daterangepicker(
- {
- format: _format,
- startDate: _t.attr('data-from'),
- endDate: _t.attr('data-to'),
+ _t.daterangepicker(
+ {
+ format: _format,
+ startDate: _t.attr("data-from"),
+ endDate: _t.attr("data-to"),
- ranges: {
- 'Today': [moment(), moment()],
- 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
- 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
- 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
- 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
- }
- },
- function(start, end, label) {
- // alert("A new date range was chosen: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
- });
+ ranges: {
+ Today: [moment(), moment()],
+ Yesterday: [
+ moment().subtract(1, "days"),
+ moment().subtract(1, "days"),
+ ],
+ "Last 7 Days": [moment().subtract(6, "days"), moment()],
+ "Last 30 Days": [moment().subtract(29, "days"), moment()],
+ "This Month": [
+ moment().startOf("month"),
+ moment().endOf("month"),
+ ],
+ "Last Month": [
+ moment()
+ .subtract(1, "month")
+ .startOf("month"),
+ moment()
+ .subtract(1, "month")
+ .endOf("month"),
+ ],
+ },
+ },
+ function(start, end, label) {
+ // alert("A new date range was chosen: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
+ }
+ );
+ });
+ }
+ }
+ );
+ }
+ );
+ }
- });
-
- }
-
- });
- });
- }
-
-
-
- /** Time Picker
+ /** Time Picker
******************* **/
- var _container_3 = jQuery('.timepicker');
-
- if(_container_3.length > 0) {
- loadScript(plugin_path + 'timepicki/timepicki.min.js', function() {
-
- if(jQuery().timepicki) {
+ var _container_3 = jQuery(".timepicker");
- _container_3.timepicki();
-
- }
+ if (_container_3.length > 0) {
+ loadScript(plugin_path + "timepicki/timepicki.min.js", function() {
+ if (jQuery().timepicki) {
+ _container_3.timepicki();
+ }
+ });
+ }
- });
- }
+ /** Color Picker
+ ******************* **/
+ var _container_4 = jQuery(".colorpicker");
+ if (_container_4.length > 0) {
+ loadScript(plugin_path + "spectrum/spectrum.min.js", function() {
+ if (jQuery().spectrum) {
+ _container_4.each(function() {
+ var _t = jQuery(this),
+ _preferredFormat = _t.attr("data-format") || "hex", // hex, hex3, hsl, rgb, name
+ _palletteOnly = _t.attr("data-palletteOnly") || "false",
+ _fullPicker = _t.attr("data-fullpicker") || "false",
+ _allowEmpty = _t.attr("data-allowEmpty") || false;
+ _flat = _t.attr("data-flat") || false;
+ if (_palletteOnly == "true" || _fullPicker == "true") {
+ var _palette = [
+ [
+ "#000",
+ "#444",
+ "#666",
+ "#999",
+ "#ccc",
+ "#eee",
+ "#f3f3f3",
+ "#fff",
+ ],
+ ["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"],
+ [
+ "#f4cccc",
+ "#fce5cd",
+ "#fff2cc",
+ "#d9ead3",
+ "#d0e0e3",
+ "#cfe2f3",
+ "#d9d2e9",
+ "#ead1dc",
+ ],
+ [
+ "#ea9999",
+ "#f9cb9c",
+ "#ffe599",
+ "#b6d7a8",
+ "#a2c4c9",
+ "#9fc5e8",
+ "#b4a7d6",
+ "#d5a6bd",
+ ],
+ [
+ "#e06666",
+ "#f6b26b",
+ "#ffd966",
+ "#93c47d",
+ "#76a5af",
+ "#6fa8dc",
+ "#8e7cc3",
+ "#c27ba0",
+ ],
+ [
+ "#c00",
+ "#e69138",
+ "#f1c232",
+ "#6aa84f",
+ "#45818e",
+ "#3d85c6",
+ "#674ea7",
+ "#a64d79",
+ ],
+ [
+ "#900",
+ "#b45f06",
+ "#bf9000",
+ "#38761d",
+ "#134f5c",
+ "#0b5394",
+ "#351c75",
+ "#741b47",
+ ],
+ [
+ "#600",
+ "#783f04",
+ "#7f6000",
+ "#274e13",
+ "#0c343d",
+ "#073763",
+ "#20124d",
+ "#4c1130",
+ ],
+ ];
+ } else {
+ _palette = null;
+ }
- /** Color Picker
- ******************* **/
- var _container_4 = jQuery('.colorpicker');
-
- if(_container_4.length > 0) {
- loadScript(plugin_path + 'spectrum/spectrum.min.js', function() {
-
- if(jQuery().spectrum) {
+ if (_t.attr("data-defaultColor")) {
+ _color = _t.attr("data-defaultColor");
+ } else {
+ _color = "#ff0000";
+ }
- _container_4.each(function() {
- var _t = jQuery(this),
- _preferredFormat = _t.attr('data-format') || "hex", // hex, hex3, hsl, rgb, name
- _palletteOnly = _t.attr('data-palletteOnly') || "false",
- _fullPicker = _t.attr('data-fullpicker') || "false",
- _allowEmpty = _t.attr('data-allowEmpty') || false;
- _flat = _t.attr('data-flat') || false;
-
- if(_palletteOnly == "true" || _fullPicker == "true") {
-
- var _palette = [
- ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
- ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
- ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
- ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
- ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
- ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
- ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
- ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
- ];
-
- } else {
- _palette = null;
- }
-
- if(_t.attr('data-defaultColor')) {
- _color = _t.attr('data-defaultColor');
- } else {
- _color = "#ff0000";
- }
-
- if(!_t.attr('data-defaultColor') && _allowEmpty == "true") {
- _color = null;
- }
-
- _t.spectrum({
- showPaletteOnly: _palletteOnly == "true" ? true : false,
- togglePaletteOnly: _palletteOnly == "true" ? true : false,
-
- flat: _flat == "true" ? true : false,
- showInitial: _allowEmpty == "true" ? true : false,
- showInput: _allowEmpty == "true" ? true : false,
- allowEmpty: _allowEmpty == "true" ? true : false,
-
- chooseText: _t.attr('data-chooseText') || "Coose",
- cancelText: _t.attr('data-cancelText') || "Cancel",
-
- color: _color,
- showInput: true,
- showPalette: true,
- preferredFormat: _preferredFormat,
- showAlpha: _preferredFormat == "rgb" ? true : false,
- palette: _palette
- });
-
- });
-
- }
-
- });
- }
-
- }
+ if (!_t.attr("data-defaultColor") && _allowEmpty == "true") {
+ _color = null;
+ }
+ _t.spectrum({
+ showPaletteOnly: _palletteOnly == "true" ? true : false,
+ togglePaletteOnly: _palletteOnly == "true" ? true : false,
+ flat: _flat == "true" ? true : false,
+ showInitial: _allowEmpty == "true" ? true : false,
+ showInput: _allowEmpty == "true" ? true : false,
+ allowEmpty: _allowEmpty == "true" ? true : false,
+ chooseText: _t.attr("data-chooseText") || "Coose",
+ cancelText: _t.attr("data-cancelText") || "Cancel",
+ color: _color,
+ showInput: true,
+ showPalette: true,
+ preferredFormat: _preferredFormat,
+ showAlpha: _preferredFormat == "rgb" ? true : false,
+ palette: _palette,
+ });
+ });
+ }
+ });
+ }
+}
/** Editors
**************************************************************** **/
- function _editors() {
-
- /** Summernote HTML Editor
+function _editors() {
+ /** Summernote HTML Editor
***************************** **/
- var _container_1 = jQuery('textarea.summernote');
-
- if(_container_1.length > 0) {
-
- loadScript(plugin_path + 'editor.summernote/summernote.min.js', function() {
-
- if(jQuery().summernote) {
+ var _container_1 = jQuery("textarea.summernote");
- _container_1.each(function() {
+ if (_container_1.length > 0) {
+ loadScript(plugin_path + "editor.summernote/summernote.min.js", function() {
+ if (jQuery().summernote) {
+ _container_1.each(function() {
+ var _lang = jQuery(this).attr("data-lang") || "en-US";
- var _lang = jQuery(this).attr('data-lang') || 'en-US';
+ if (_lang != "en-US") {
+ // Language!
+ alert(_lang);
+ loadScript(
+ plugin_path + "editor.summernote/lang/summernote-" + _lang + ".js"
+ );
+ }
- if(_lang != 'en-US') { // Language!
- alert(_lang);
- loadScript(plugin_path + 'editor.summernote/lang/summernote-'+_lang+'.js');
- }
+ jQuery(this).summernote({
+ height: jQuery(this).attr("data-height") || 200,
+ lang: jQuery(this).attr("data-lang") || "en-US", // default: 'en-US'
+ toolbar: [
+ /* [groupname, [button list]] */
+ ["style", ["style"]],
+ ["fontsize", ["fontsize"]],
+ [
+ "style",
+ ["bold", "italic", "underline", "strikethrough", "clear"],
+ ],
+ ["color", ["color"]],
+ ["para", ["ul", "ol", "paragraph"]],
+ ["table", ["table"]],
+ ["media", ["link", "picture", "video"]],
+ ["misc", ["codeview", "fullscreen", "help"]],
+ ],
+ });
+ });
+ }
+ });
+ }
- jQuery(this).summernote({
- height: jQuery(this).attr('data-height') || 200,
- lang: jQuery(this).attr('data-lang') || 'en-US', // default: 'en-US'
- toolbar: [
- /* [groupname, [button list]] */
- ['style', ['style']],
- ['fontsize', ['fontsize']],
- ['style', ['bold', 'italic', 'underline','strikethrough', 'clear']],
- ['color', ['color']],
- ['para', ['ul', 'ol', 'paragraph']],
- ['table', ['table']],
- ['media', ['link', 'picture', 'video']],
- ['misc', ['codeview', 'fullscreen', 'help']]
- ]
- });
- });
-
- }
- });
- }
-
-
-
-
-
- /** Markdown HTML Editor
+ /** Markdown HTML Editor
***************************** **/
- var _container_2 = jQuery('textarea.markdown');
-
- if(_container_2.length > 0) {
-
- loadScript(plugin_path + 'editor.markdown/js/bootstrap-markdown.min.js', function() {
-
- if(jQuery().markdown) {
-
- _container_2.each(function() {
- var _t = jQuery(this);
-
- var _lang = _t.attr('data-lang') || 'en';
-
- if(_lang != 'en') { // Language!
- loadScript(plugin_path + 'editor.markdown/locale/bootstrap-markdown.'+_lang+'.js');
- }
-
- jQuery(this).markdown({
- autofocus: _t.attr('data-autofocus') == "true" ? true : false,
- savable: _t.attr('data-savable') == "true" ? true : false,
- height: _t.attr('data-height') || 'inherit',
- language: _lang == 'en' ? null : _lang
- });
-
- });
-
- }
-
- });
-
- }
-
- }
-
+ var _container_2 = jQuery("textarea.markdown");
+ if (_container_2.length > 0) {
+ loadScript(
+ plugin_path + "editor.markdown/js/bootstrap-markdown.min.js",
+ function() {
+ if (jQuery().markdown) {
+ _container_2.each(function() {
+ var _t = jQuery(this);
+ var _lang = _t.attr("data-lang") || "en";
+ if (_lang != "en") {
+ // Language!
+ loadScript(
+ plugin_path +
+ "editor.markdown/locale/bootstrap-markdown." +
+ _lang +
+ ".js"
+ );
+ }
+ jQuery(this).markdown({
+ autofocus: _t.attr("data-autofocus") == "true" ? true : false,
+ savable: _t.attr("data-savable") == "true" ? true : false,
+ height: _t.attr("data-height") || "inherit",
+ language: _lang == "en" ? null : _lang,
+ });
+ });
+ }
+ }
+ );
+ }
+}
/** Pajinate [jQuery Pagination]
USAGE
@@ -3285,357 +3090,299 @@