From 1a43060996885f417798449feb068122c62d38d4 Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Thu, 2 Jan 2020 19:22:30 +0100 Subject: [PATCH] Tickets #4, #5, #6 --- .idea/workspace.xml | 74 +++++++-- .phpstorm.meta.php | 2 +- _ide_helper.php | 2 +- _ide_helper_models.php | 102 +++++++++++- app/Http/Controllers/AdminUserController.php | 4 +- app/Http/Controllers/CountryController.php | 77 +++++++++ app/Http/Controllers/LeadController.php | 21 ++- app/Http/Controllers/ProductController.php | 13 +- app/Http/Controllers/UserLevelController.php | 84 ++++++++++ app/Models/Category.php | 4 +- app/Models/Country.php | 59 ++++++- app/Models/IqImage.php | 2 + app/Models/IqSite.php | 27 +++ app/Models/Product.php | 5 + app/Models/ProductImage.php | 2 + app/Models/ShoppingOrder.php | 6 +- app/Models/UserAccount.php | 22 ++- app/Models/UserLevel.php | 79 +++++++++ app/Repositories/ProductRepository.php | 52 ++++++ app/Repositories/UserRepository.php | 2 +- app/Services/HTMLHelper.php | 26 +++ .../2014_10_12_000000_create_users_table.php | 1 + ...18_09_29_145909_create_countries_table.php | 9 + ...018_10_21_164001_create_products_table.php | 5 +- ...2_29_170559_create_user_accounts_table.php | 8 +- ..._01_02_165917_create_user_levels_table.php | 42 +++++ resources/lang/de.json | 4 +- resources/views/admin/country/edit.blade.php | 43 +++++ resources/views/admin/country/form.blade.php | 102 ++++++++++++ resources/views/admin/country/index.blade.php | 67 ++++++++ .../edit.blade.php} | 14 +- .../{leads.blade.php => lead/index.blade.php} | 4 +- .../views/admin/lead/m_data_form.blade.php | 40 +++++ resources/views/admin/level/index.blade.php | 155 ++++++++++++++++++ resources/views/admin/product/form.blade.php | 25 +-- resources/views/admin/product/index.blade.php | 7 +- .../edit.blade.php} | 0 .../{users.blade.php => user/index.blade.php} | 0 .../layouts/includes/layout-sidenav.blade.php | 11 +- resources/views/user/user_form.blade.php | 29 ++-- resources/views/user/user_new_form.blade.php | 2 +- routes/web.php | 10 ++ 42 files changed, 1160 insertions(+), 83 deletions(-) create mode 100755 app/Http/Controllers/CountryController.php create mode 100755 app/Http/Controllers/UserLevelController.php create mode 100644 app/Models/UserLevel.php create mode 100644 database/migrations/2020_01_02_165917_create_user_levels_table.php create mode 100755 resources/views/admin/country/edit.blade.php create mode 100755 resources/views/admin/country/form.blade.php create mode 100644 resources/views/admin/country/index.blade.php rename resources/views/admin/{lead_edit.blade.php => lead/edit.blade.php} (73%) rename resources/views/admin/{leads.blade.php => lead/index.blade.php} (93%) create mode 100644 resources/views/admin/lead/m_data_form.blade.php create mode 100755 resources/views/admin/level/index.blade.php rename resources/views/admin/{user_edit.blade.php => user/edit.blade.php} (100%) rename resources/views/admin/{users.blade.php => user/index.blade.php} (100%) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 93a2515..5afaa57 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,13 +2,46 @@ - - - + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - @@ -312,7 +346,7 @@ - + @@ -342,10 +376,14 @@ - + - + + + + + diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 005e956..658bcc5 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -5,7 +5,7 @@ namespace PHPSTORM_META { /** * PhpStorm Meta file, to provide autocomplete information for PhpStorm - * Generated on 2019-11-23 08:47:41. + * Generated on 2020-01-02 16:09:05. * * @author Barry vd. Heuvel * @see https://github.com/barryvdh/laravel-ide-helper diff --git a/_ide_helper.php b/_ide_helper.php index 0992186..16347f7 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -3,7 +3,7 @@ /** * A helper file for Laravel 5, to provide autocomplete information to your IDE - * Generated for Laravel 5.6.39 on 2019-11-23 08:47:41. + * Generated for Laravel 5.6.39 on 2020-01-02 16:09:04. * * This file should not be included in your code, only analyzed by your IDE! * diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 703ccda..79837f7 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -104,6 +104,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereShippingId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereUpdatedAt($value) + * @mixin \Eloquent */ class ShippingCountry extends \Eloquent {} } @@ -139,9 +140,16 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category query() * @property string|null $headline + * @property int|null $headline_image_id + * @property array|null $trans_headline * @property-read int|null $childrens_count - * @property-read int|null $product_categories_count + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Image[] $image + * @property-read int|null $image_count * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadline($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadlineImageId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTransHeadline($value) + * @property-read \App\Models\IqImage|null $iq_image + * @property-read int|null $product_categories_count */ class Category extends \Eloquent {} } @@ -173,6 +181,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereShoppingOrderId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereSlug($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUpdatedAt($value) + * @mixin \Eloquent */ class ShoppingOrderItem extends \Eloquent {} } @@ -228,6 +237,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightFrom($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightTo($value) + * @mixin \Eloquent */ class ShippingPrice extends \Eloquent {} } @@ -297,6 +307,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingSalutation($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingZipcode($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereUpdatedAt($value) + * @mixin \Eloquent */ class ShoppingUser extends \Eloquent {} } @@ -325,6 +336,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereSubdomain($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereUserShopId($value) + * @mixin \Eloquent */ class ShoppingInstance extends \Eloquent {} } @@ -410,6 +422,10 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereAction($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereShowAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereWeight($value) + * @property int|null $points + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductImage[] $imagesActive + * @property-read int|null $images_active_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product wherePoints($value) */ class Product extends \Eloquent {} } @@ -439,6 +455,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereTransName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereUpdatedAt($value) + * @mixin \Eloquent */ class Shipping extends \Eloquent {} } @@ -469,6 +486,14 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country query() + * @property int|null $active + * @property array|null $trans + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTrans($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereUpdatedAt($value) */ class Country extends \Eloquent {} } @@ -505,6 +530,8 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query() + * @property int|null $pos + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage wherePos($value) */ class ProductImage extends \Eloquent {} } @@ -543,6 +570,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereTxaction($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereWallettype($value) + * @mixin \Eloquent */ class ShoppingPayment extends \Eloquent {} } @@ -583,6 +611,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereTxid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUserid($value) + * @mixin \Eloquent */ class PaymentTransaction extends \Eloquent {} } @@ -667,10 +696,79 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUserShopId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWeight($value) + * @mixin \Eloquent */ class ShoppingOrder extends \Eloquent {} } +namespace App\Models{ +/** + * App\Models\ProductImage + * + * @property int $id + * @property int|null $product_id + * @property string $filename + * @property string $original_name + * @property string $ext + * @property string $mine + * @property int $size + * @property int $active + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @property-read \App\Models\Product|null $product + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereExt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereFilename($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereMine($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereOriginalName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereProductId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSize($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereUpdatedAt($value) + * @mixin \Eloquent + * @property string|null $slug + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage findSimilarSlugs($attribute, $config, $slug) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSlug($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query() + * @property int|null $pos + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqImage wherePos($value) + */ + class IqImage extends \Eloquent {} +} + +namespace App\Models{ +/** + * App\Models\IqSite + * + * @property int $id + * @property string $slug + * @property string|null $headline + * @property string|null $copy + * @property array|null $products + * @property array|null $set_products + * @property int|null $iq_image_id + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @property-read \App\Models\IqImage|null $iq_image + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereCopy($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereHeadline($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereIqImageId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereProducts($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereSetProducts($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereSlug($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereUpdatedAt($value) + */ + class IqSite extends \Eloquent {} +} + namespace App\Models{ /** * App\Models\UserAccount @@ -850,6 +948,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShop whereUserId($value) * @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withTrashed() * @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withoutTrashed() + * @mixin \Eloquent */ class UserShop extends \Eloquent {} } @@ -883,6 +982,7 @@ namespace App\Models{ * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShopOnSite whereSlug($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShopOnSite whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShopOnSite whereUserShopId($value) + * @mixin \Eloquent */ class UserShopOnSite extends \Eloquent {} } diff --git a/app/Http/Controllers/AdminUserController.php b/app/Http/Controllers/AdminUserController.php index b96d6a4..ad4483a 100755 --- a/app/Http/Controllers/AdminUserController.php +++ b/app/Http/Controllers/AdminUserController.php @@ -35,7 +35,7 @@ class AdminUserController extends Controller //'values' => User::where('admin', 0)->get(), 'values' => User::where('confirmation_code_remider', '!=', 2)->get(), ]; - return view('admin.users', $data); + return view('admin.user.index', $data); } public function edit($user_id) @@ -48,7 +48,7 @@ class AdminUserController extends Controller $data = [ 'user' => $user, ]; - return view('admin.user_edit', $data); + return view('admin.user.edit', $data); } diff --git a/app/Http/Controllers/CountryController.php b/app/Http/Controllers/CountryController.php new file mode 100755 index 0000000..5ee6e9e --- /dev/null +++ b/app/Http/Controllers/CountryController.php @@ -0,0 +1,77 @@ +middleware('admin'); + + } + + /** + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function index() + { + $data = [ + 'values' => Country::all(), + ]; + return view('admin.country.index', $data); + } + + + public function edit($id) + { + if($id === "new"){ + $model = new Country(); + $model->active = true; + }else{ + $model = Country::findOrFail($id); + } + $data = [ + 'country' => $model, + 'trans' => array_keys(config('localization.supportedLocales')), + + ]; + return view('admin.country.edit', $data); + } + + public function store() + { + + $data = Input::all(); + if(!isset($data['attr'])){ + $data['attr'] = []; + } + if($data['id'] === "new"){ + $model = Country::create([ + /* 'parent_id' => null, + 'name' => $data['name'], + 'pos' => $data['pos'], + 'active' => isset($data['active']) ? true : false, + */ + ]); + }else{ + $model = Country::find($data['id']); + $model->fill($data); + $model->save(); + } + + + \Session()->flash('alert-save', '1'); + return redirect(route('admin_country_edit', $model->id)); + + + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/LeadController.php b/app/Http/Controllers/LeadController.php index fc096e4..aab15c1 100755 --- a/app/Http/Controllers/LeadController.php +++ b/app/Http/Controllers/LeadController.php @@ -34,7 +34,7 @@ class LeadController extends Controller $data = [ 'values' => User::where('admin', '=', 0)->where('confirmation_code_remider', '!=', 2)->get(), ]; - return view('admin.leads', $data); + return view('admin.lead.index', $data); } @@ -44,7 +44,7 @@ class LeadController extends Controller */ public function edit($id) { - if($id == "new"){ + if($id === "new"){ $user = new User(); $user->account = new UserAccount(); $user->account->same_as_billing = 1; @@ -61,7 +61,7 @@ class LeadController extends Controller 'user' => $user, 'can_change_mail' => true, ]; - return view('admin.lead_edit', $data); + return view('admin.lead.edit', $data); } /** @@ -72,7 +72,7 @@ class LeadController extends Controller { $data = Input::all(); - if ($data['user_id'] == "new" || $data['user_id'] == 0) { + if ($data['user_id'] === "new" || $data['user_id'] == 0) { $rules = array( 'salutation' => 'required', 'first_name'=>'required', @@ -108,7 +108,7 @@ class LeadController extends Controller $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - if ($data['user_id'] == "new" || $data['user_id'] == 0) { + if ($data['user_id'] === "new" || $data['user_id'] == 0) { $user_id = "new"; }else{ $user = User::findOrFail($data['user_id']); @@ -117,7 +117,7 @@ class LeadController extends Controller return redirect(route('admin_lead_edit', [$user_id]))->withErrors($validator)->withInput(Input::all()); }else{ - if ($data['user_id'] == "new" || $data['user_id'] == 0) { + if ($data['user_id'] === "new" || $data['user_id'] == 0) { $user = new User(); $user->id = "new"; $user->account = new UserAccount(); @@ -129,8 +129,12 @@ class LeadController extends Controller } } + $user->m_level = isset($data['m_level']) ? $data['m_level'] : NULL; + $user->save(); + $this->userRepo->update($data); + if(isset($data['contact_verify'])){ $user = $this->userRepo->getModel(); @@ -150,10 +154,13 @@ class LeadController extends Controller Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user)); + + \Session()->flash('alert-save', true); + return redirect(route('admin_leads')); } \Session()->flash('alert-save', true); - return redirect(route('admin_leads')); + return redirect(route('admin_lead_edit', [$user->id])); diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index c189f57..a183bc0 100755 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -24,7 +24,7 @@ class ProductController extends Controller public function index() { $data = [ - 'values' => Product::all(), + 'values' => Product::orderBy('pos', 'DESC')->orderBy('id', 'DESC')->get(), ]; return view('admin.product.index', $data); } @@ -78,6 +78,17 @@ class ProductController extends Controller } + public function copy($id){ + $model = Product::findOrFail($id); + + $product = $this->productRepo->copy($model); + + + + \Session()->flash('alert-success', 'Eintrag kopiert'); + return redirect(route('admin_product_show')); + } + public function delete($id){ $model = Product::findOrFail($id); $model->delete(); diff --git a/app/Http/Controllers/UserLevelController.php b/app/Http/Controllers/UserLevelController.php new file mode 100755 index 0000000..bea822b --- /dev/null +++ b/app/Http/Controllers/UserLevelController.php @@ -0,0 +1,84 @@ +middleware('admin'); + } + + public function index() + { + + $data = [ + 'values' => UserLevel::all(), + 'trans' => array_keys(config('localization.supportedLocales')), + ]; + return view('admin.level.index', $data); + } + + public function store() + { + + $data = Input::all(); + if($data['id'] == "new"){ + $model = UserLevel::create([ + 'name' => $data['name'], + 'pos' => $data['pos'], + 'margin' => $data['margin'], + 'active' => isset($data['active']) ? true : false, + ]); + }else{ + $model = UserLevel::find($data['id']); + $model->name = $data['name']; + $model->pos = $data['pos']; + $model->margin = $data['margin']; + $model->active = isset($data['active']) ? true : false; + $model->save(); + } + + if(!empty($data['trans'])){ + $trans = []; + foreach ($data['trans'] as $lang => $value){ + if($value && $value != null){ + $trans[$lang] = $value; + } + } + if(count($trans)){ + $model->trans_name = $trans; + $model->save(); + } + } + + \Session()->flash('alert-save', '1'); + return redirect(route('admin_levels')); + + + } + + + /*public function delete($id){ + + if(ProductAttribute::where('attribute_id', $id)->count()){ + \Session()->flash('alert-error', 'Eintrag wird als Produktattribute verwendet'); + return redirect(route('admin_product_attributes')); + } + + $model = Attribute::findOrFail($id); + $model->delete(); + \Session()->flash('alert-success', 'Eintrag gelöscht'); + return redirect(route('admin_product_attributes')); + } + */ + +} \ No newline at end of file diff --git a/app/Models/Category.php b/app/Models/Category.php index 62621ab..8f8415d 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -43,6 +43,8 @@ use Cviebrock\EloquentSluggable\Sluggable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadline($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadlineImageId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTransHeadline($value) + * @property-read \App\Models\IqImage|null $iq_image + * @property-read int|null $product_categories_count */ class Category extends Model { @@ -93,7 +95,7 @@ class Category extends Model public function getLang($key) { $lang = \App::getLocale(); - if ($lang == 'de') { + if ($lang === 'de') { return $this->{$key}; } $trans = $this->getTrans($key, $lang); diff --git a/app/Models/Country.php b/app/Models/Country.php index 6d23886..7b57e7b 100644 --- a/app/Models/Country.php +++ b/app/Models/Country.php @@ -30,37 +30,80 @@ use PHPUnit\Framework\Constraint\Count; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country query() + * @property int|null $active + * @property array|null $trans + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTrans($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereUpdatedAt($value) + * @property string|null $trans_name + * @property array|null $attr + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereAttr($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTransName($value) */ class Country extends Model { protected $table = 'countries'; + protected $casts = ['trans_name' => 'array', 'attr' => 'array']; - public function getLocated($lang = 'de'){ + protected $fillable = [ + 'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru', 'active', 'trans_name', 'attr' + ]; - $lang = \App::getLocale(); + public function getLocated($lang = false){ - if($lang == 'de'){ + if(!$lang){ + $lang = \App::getLocale(); + + } + if($lang === 'de'){ return $this->de; } - if($lang == 'en'){ + if($lang === 'en'){ return $this->en; } - if($lang == 'es'){ + if($lang === 'es'){ return $this->es; } - if($lang == 'fr'){ + if($lang === 'fr'){ return $this->fr; } - if($lang == 'it'){ + if($lang === 'it'){ return $this->it; } - if($lang == 'ru'){ + if($lang === 'ru'){ return $this->ru; } + + //search by trans + + if($val = $this->getTrans('name', $lang)){ + return $val; + } return $this->de; } + public function getTrans($key, $lang) + { + $key = 'trans_' . $key; + if (!empty($this->{$key}[$lang])) { + return $this->{$key}[$lang]; + } + return ""; + } + + public function getAttrByKey($key) + { + $name = 'attr'; + if (!empty($this->{$name}[$key])) { + return $this->{$name}[$key]; + } + return ""; + } + public static function getCountryIdByCode($code){ if($code == null){ return null; diff --git a/app/Models/IqImage.php b/app/Models/IqImage.php index e59bcaa..3291452 100644 --- a/app/Models/IqImage.php +++ b/app/Models/IqImage.php @@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query() + * @property int|null $pos + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqImage wherePos($value) */ class IqImage extends Model { diff --git a/app/Models/IqSite.php b/app/Models/IqSite.php index 5369703..34eb80f 100644 --- a/app/Models/IqSite.php +++ b/app/Models/IqSite.php @@ -5,6 +5,33 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * App\Models\IqSite + * + * @property int $id + * @property string $slug + * @property string|null $headline + * @property string|null $copy + * @property array|null $products + * @property array|null $set_products + * @property int|null $iq_image_id + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @property-read \App\Models\IqImage|null $iq_image + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereCopy($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereHeadline($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereIqImageId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereProducts($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereSetProducts($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereSlug($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqSite whereUpdatedAt($value) + * @mixin \Eloquent + */ class IqSite extends Model { diff --git a/app/Models/Product.php b/app/Models/Product.php index d16e37f..c63ac30 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -86,6 +86,10 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereAction($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereShowAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereWeight($value) + * @property int|null $points + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductImage[] $imagesActive + * @property-read int|null $images_active_count + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product wherePoints($value) */ class Product extends Model { @@ -117,6 +121,7 @@ class Product extends Model 'price_ek', 'tax', 'price_old', + 'points', 'weight', 'contents', 'number', diff --git a/app/Models/ProductImage.php b/app/Models/ProductImage.php index fea9da5..25f7db2 100644 --- a/app/Models/ProductImage.php +++ b/app/Models/ProductImage.php @@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query() + * @property int|null $pos + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage wherePos($value) */ class ProductImage extends Model { diff --git a/app/Models/ShoppingOrder.php b/app/Models/ShoppingOrder.php index da3e1ff..0cc0bee 100644 --- a/app/Models/ShoppingOrder.php +++ b/app/Models/ShoppingOrder.php @@ -110,7 +110,7 @@ class ShoppingOrder extends Model public function getFormattedShipping() { - if (\App::getLocale() == "en") { + if (\App::getLocale() === "en") { return number_format($this->attributes['shipping'], 2, '.', ','); } return number_format($this->attributes['shipping'], 2, ',', '.'); @@ -118,7 +118,7 @@ class ShoppingOrder extends Model public function getFormattedTotalShipping() { - if (\App::getLocale() == "en") { + if (\App::getLocale() === "en") { return number_format($this->attributes['total_shipping'], 2, '.', ','); } return number_format($this->attributes['total_shipping'], 2, ',', '.'); @@ -127,7 +127,7 @@ class ShoppingOrder extends Model public function getFormattedPrice() { - if (\App::getLocale() == "en") { + if (\App::getLocale() === "en") { return number_format($this->attributes['price'], 2, '.', ','); } return number_format($this->attributes['price'], 2, ',', '.'); diff --git a/app/Models/UserAccount.php b/app/Models/UserAccount.php index ff2bd1d..c1b266a 100644 --- a/app/Models/UserAccount.php +++ b/app/Models/UserAccount.php @@ -105,11 +105,9 @@ use Carbon\Carbon; class UserAccount extends Model { protected $table = 'user_accounts'; - - protected $fillable = [ - 'company', 'salutation', 'first_name', 'last_name', 'address', 'address_2', 'zipcode', 'city', 'country_id', 'pre_phone_id', 'phone', 'pre_mobil_id', 'mobil', - 'tax_number', 'tax_identification_number', 'same_as_billing', + 'm_account', 'm_salutation', 'm_first_name', 'm_last_name', 'm_notes', 'company', 'salutation', 'first_name', 'last_name', 'address', 'address_2', 'zipcode', 'city', 'country_id', 'pre_phone_id', 'phone', 'pre_mobil_id', 'mobil', + 'tax_number', 'tax_identification_number', 'taxable_sales', 'same_as_billing', 'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_country_id', 'shipping_pre_phone_id', 'shipping_phone', 'birthday', 'website', 'facebook', 'facebook_fanpage', 'instagram' ]; @@ -166,6 +164,22 @@ class UserAccount extends Model } + public function getCountryAttrAs($attr, $as = false){ + if($this->country){ + $val = $this->country->getAttrByKey($attr); + + if($val){ + if($as){ + return $as; + } + return true; + + } + } + return ""; + } + + } diff --git a/app/Models/UserLevel.php b/app/Models/UserLevel.php new file mode 100644 index 0000000..61ec277 --- /dev/null +++ b/app/Models/UserLevel.php @@ -0,0 +1,79 @@ + 'array']; + + protected $fillable = [ + 'name', 'margin', 'pos', 'active', + ]; + + + /* public function childrens() + { + return $this->hasMany('App\Models\Attribute', 'parent_id', 'id'); + } + */ + + public function setPosAttribute($value){ + $this->attributes['pos'] = is_numeric($value) ? $value : null; + + } + + + public function _format_number($value){ + return preg_replace("/[^0-9,]/", "", $value); + } + + public function setMarginAttribute( $value ) { + $value = $this->_format_number($value); + $this->attributes['margin'] = floatval(str_replace(',', '.', $value)); + } + + public function getFormattedMargin() + { + if(!isset($this->attributes['margin'])){ + return ""; + } + if(\App::getLocale() === "en"){ + return number_format($this->attributes['margin'], 2, '.', ','); + } + return number_format($this->attributes['margin'], 2, ',', '.'); + } + + public function getLang($key) + { + $lang = \App::getLocale(); + if ($lang === 'de') { + return $this->{$key}; + } + $trans = $this->getTrans($key, $lang); + if (!$trans || $trans == '') { + return $this->{$key}; + } + return $trans; + } + + public function getTrans($key, $lang) + { + $key = 'trans_' . $key; + if (!empty($this->{$key}[$lang])) { + return $this->{$key}[$lang]; + } + } + + public function getTranNames() + { + $ret = ""; + foreach ((array) $this->trans_name as $value){ + $ret .= $value.', '; + } + return rtrim($ret, ', '); + } +} diff --git a/app/Repositories/ProductRepository.php b/app/Repositories/ProductRepository.php index 8df257e..9aaf82b 100644 --- a/app/Repositories/ProductRepository.php +++ b/app/Repositories/ProductRepository.php @@ -7,6 +7,7 @@ namespace App\Repositories; use App\Models\Product; use App\Models\ProductAttribute; use App\Models\ProductCategory; +use App\Models\ProductImage; class ProductRepository extends BaseRepository { @@ -84,6 +85,57 @@ class ProductRepository extends BaseRepository { } + public function copy($model) + { + $this->model = $model->replicate(); + $this->model->name = "Kopie: ".$this->model->name; + $this->model->save(); + + //categories + foreach ($model->categories as $category){ + ProductCategory::create([ + 'product_id' => $this->model->id, + 'category_id' => $category->category_id, + ]); + } + + //attributes + foreach ($model->attributes as $attribute){ + ProductAttribute::create([ + 'product_id' => $this->model->id, + 'attribute_id' => $attribute->attribute_id, + ]); + } + + //images + foreach ($model->images as $image){ + $name = \App\Services\Slim::sanitizeFileName($image->original_name); + $name = uniqid() . '_' . $name; + + //copy + $data = \Storage::disk('public')->copy( + 'images/product/'.$image->product_id.'/'.$image->filename, + 'images/product/'.$this->model->id.'/'.$name + ); + + + ProductImage::create([ + 'product_id' => $this->model->id, + 'filename' => $name, + 'original_name' => $image->original_name, + 'ext' => $image->ext, + 'mine' => $image->mine, + 'size' => $image->size + ]); + } + + + return $this->model; + } + + + + public function delete() diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 234fefa..0e87ae7 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -18,7 +18,7 @@ class UserRepository extends BaseRepository { public function update($data) { - if($data['user_id'] == "new" || $data['user_id'] == 0){ + if($data['user_id'] === "new" || $data['user_id'] == 0){ $this->model = User::create([ 'email' => $data['email'], diff --git a/app/Services/HTMLHelper.php b/app/Services/HTMLHelper.php index 45ffcc0..005850c 100644 --- a/app/Services/HTMLHelper.php +++ b/app/Services/HTMLHelper.php @@ -6,6 +6,7 @@ use App\Models\Category; use App\Models\Country; use App\Models\Product; use App\Models\ShippingCountry; +use App\Models\UserLevel; class HTMLHelper { @@ -156,6 +157,19 @@ class HTMLHelper return $ret; } + public static function getUserLevelOptions($id = false, $all = true){ + $values = UserLevel::where('active', 1)->get(); + $ret = ""; + if($all){ + $ret .= '\n'; + } + foreach ($values as $value){ + $attr = ($value->id == $id) ? 'selected="selected"' : ''; + $ret .= '\n'; + } + return $ret; + } + public static function getCompanyOptions($company){ $options = array(1 => __('business'), 0 => __('private'), ); @@ -258,6 +272,18 @@ class HTMLHelper return (!empty($values[$id]) ? $values[$id] : ''); } + public static function getTaxSaleOptions($id){ + $values = array('1' => __('taxable_sales_1'), '2' => __('taxable_sales_2')); + $ret = ""; + $ret .= '\n'; + foreach ($values as $key => $value){ + $attr = ($key == $id) ? 'selected="selected"' : ''; + $ret .= '\n'; + } + return $ret; + } + + /*public static function getIndustrySectorsWithoutParents($id = false, $sameId = false, $all = true){ $values = IndustrySector::where('parent_id', null)->get(); $ret = ""; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 91013ef..d3ae6ee 100755 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -19,6 +19,7 @@ class CreateUsersTable extends Migration $table->string('password'); $table->unsignedInteger('account_id')->nullable(); + $table->unsignedInteger('m_level')->nullable(); $table->boolean('confirmed')->default(false); $table->string('confirmation_code', 30)->index()->nullable(); diff --git a/database/migrations/2018_09_29_145909_create_countries_table.php b/database/migrations/2018_09_29_145909_create_countries_table.php index e96ebb7..3e8e026 100644 --- a/database/migrations/2018_09_29_145909_create_countries_table.php +++ b/database/migrations/2018_09_29_145909_create_countries_table.php @@ -23,6 +23,15 @@ class CreateCountriesTable extends Migration $table->string('fr', 100); $table->string('it', 100); $table->string('ru', 100); + + $table->boolean('active')->default(true); + $table->text('trans_name')->nullable(); + $table->text('attr')->nullable(); + + + $table->timestamps(); + + }); } diff --git a/database/migrations/2018_10_21_164001_create_products_table.php b/database/migrations/2018_10_21_164001_create_products_table.php index e424d69..52b3558 100644 --- a/database/migrations/2018_10_21_164001_create_products_table.php +++ b/database/migrations/2018_10_21_164001_create_products_table.php @@ -28,10 +28,11 @@ class CreateProductsTable extends Migration $table->decimal('price', 8, 2)->nullable(); $table->decimal('price_ek', 8, 2)->nullable(); $table->decimal('tax', 5, 2)->nullable(); - $table->decimal('price_old', 8, 2)->nullable(); //streichpreis - $table->unsignedInteger('weight')->nullable(); + + $table->unsignedInteger('points')->nullable()->default(0); + $table->unsignedInteger('weight')->nullable()->default(0); $table->string('contents')->nullable(); diff --git a/database/migrations/2019_02_29_170559_create_user_accounts_table.php b/database/migrations/2019_02_29_170559_create_user_accounts_table.php index f7b1cc0..a38148f 100644 --- a/database/migrations/2019_02_29_170559_create_user_accounts_table.php +++ b/database/migrations/2019_02_29_170559_create_user_accounts_table.php @@ -16,6 +16,12 @@ class CreateUserAccountsTable extends Migration Schema::create('user_accounts', function (Blueprint $table) { $table->increments('id'); + $table->string('m_account')->nullable(); + $table->char('m_salutation', 2)->nullable(); + $table->string('m_first_name')->nullable(); + $table->string('m_last_name')->nullable(); + $table->text('m_notes')->nullable(); + $table->string('company')->nullable(); $table->char('salutation', 2)->nullable(); @@ -35,7 +41,7 @@ class CreateUserAccountsTable extends Migration $table->string('tax_number', 20)->nullable(); $table->string('tax_identification_number', 20)->nullable(); - + $table->unsignedTinyInteger('taxable_sales')->nullable(); $table->boolean('same_as_billing')->default(true); diff --git a/database/migrations/2020_01_02_165917_create_user_levels_table.php b/database/migrations/2020_01_02_165917_create_user_levels_table.php new file mode 100644 index 0000000..9fdf8a9 --- /dev/null +++ b/database/migrations/2020_01_02_165917_create_user_levels_table.php @@ -0,0 +1,42 @@ +increments('id'); + + $table->string('name')->index(); + $table->text('trans_name')->nullable(); + $table->decimal('margin', 8, 2)->nullable(); + + $table->tinyInteger('pos')->unsigned()->nullable(); + $table->boolean('active')->default(false); + + + + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('user_levels'); + } +} diff --git a/resources/lang/de.json b/resources/lang/de.json index 5d5e75b..5a86726 100755 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -192,5 +192,7 @@ "shop on site copy":"Warst du auf der Aloe Vera Farm auf Mallorca? Lade hier bis zu 6 Bilder von Dir hoch.", "open your shop": "Eröffne Deinen eigenen mivita-Shop", "settings your shop":"Deine Shop-Einstellungen", - "":"" + "taxable_sales_1":"umsatzsteuerpflichtig (Sie machen einen UST-Voranmeldung pro Monat / Quartal / Jahr ans Finanzamt)", + "taxable_sales_2":"nicht umsatzsteuerpflichtig (Kleinunternehmer im Sinne von § 19)", + "": "" } \ No newline at end of file diff --git a/resources/views/admin/country/edit.blade.php b/resources/views/admin/country/edit.blade.php new file mode 100755 index 0000000..d26c9b5 --- /dev/null +++ b/resources/views/admin/country/edit.blade.php @@ -0,0 +1,43 @@ +@extends('layouts.layout-2') + +@section('content') + + @if ($errors->any()) +
+
+
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+
+
+ @endif + +

+ {{ __('Create/Edit Land') }} +

+ + {!! Form::open(['url' => route('admin_country_store'), 'class' => 'form-horizontal', 'id'=>'']) !!} + + + +
+   + {{ __('back') }} +
+ + @include('admin.country.form') + +
+   + {{ __('back') }} +
+ + {!! Form::close() !!} + + + +@endsection diff --git a/resources/views/admin/country/form.blade.php b/resources/views/admin/country/form.blade.php new file mode 100755 index 0000000..653dd8a --- /dev/null +++ b/resources/views/admin/country/form.blade.php @@ -0,0 +1,102 @@ + +
+ +
+ {{ __('Land') }} + + +
+
+
+
+ + {{ Form::text('name', $country->de, array('placeholder'=>__('Land DE'), 'class'=>'form-control', 'id'=>'de', 'required')) }} +
+
+ + {{ Form::text('en', $country->en, array('placeholder'=>__('Land EN'), 'class'=>'form-control', 'id'=>'en')) }} +
+
+ + {{ Form::text('es', $country->es, array('placeholder'=>__('Land ES'), 'class'=>'form-control', 'id'=>'es')) }} +
+
+ + {{ Form::text('fr', $country->fr, array('placeholder'=>__('Land FR'), 'class'=>'form-control', 'id'=>'fr')) }} +
+
+ + {{ Form::text('it', $country->it, array('placeholder'=>__('Land IT'), 'class'=>'form-control', 'id'=>'it')) }} +
+
+ + {{ Form::text('ru', $country->ru, array('placeholder'=>__('Land RU'), 'class'=>'form-control', 'id'=>'ru')) }} +
+
+
+
+
+ + {{ Form::text('code', $country->code, array('placeholder'=>__('code'), 'class'=>'form-control', 'id'=>'code')) }} +
+
+ + {{ Form::text('phone', $country->phone, array('placeholder'=>__('phone'), 'class'=>'form-control', 'id'=>'phone')) }} +
+
+
+
+ + + +
+
+ {{ __('Pflichtfelder') }} +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ + + +
+
+ {{ __('Übersetzungen') }} +
+
+ @foreach($trans as $lang) + @if(!in_array($lang, ['en', 'de', 'es', 'fr', 'it', 'ru'])) +
+
+ + {{ Form::text('trans_name['.$lang.']', $country->getLocated($lang), array('class'=>'form-control', 'id'=>'trans_name_'.$lang)) }} +
+
+ @endif + @endforeach +
+
+ diff --git a/resources/views/admin/country/index.blade.php b/resources/views/admin/country/index.blade.php new file mode 100644 index 0000000..a6584fa --- /dev/null +++ b/resources/views/admin/country/index.blade.php @@ -0,0 +1,67 @@ +@extends('layouts.layout-2') + +@section('content') + +
+
+ {{__('Länder')}} +
+
+ + + + + + + + + + + + @foreach($values as $value) + + + + + + + + @endforeach + +
 {{__('DE')}}{{__('Code')}}{{__('Phone')}}{{__('Status')}}
+ + + + {{ $value->de }}{{ $value->code }}{{ $value->phone }}@if($value->active) @else@endif
+
+ +
+
+
+ + +@endsection + diff --git a/resources/views/admin/lead_edit.blade.php b/resources/views/admin/lead/edit.blade.php similarity index 73% rename from resources/views/admin/lead_edit.blade.php rename to resources/views/admin/lead/edit.blade.php index dc58da6..56e32cc 100644 --- a/resources/views/admin/lead_edit.blade.php +++ b/resources/views/admin/lead/edit.blade.php @@ -17,7 +17,7 @@ @endif

- @if(!$user->id || $user->id == 'new') + @if(!$user->id || $user->id === 'new') {{ __('Neuen Berater erstellen') }} @else {{ __('Berater bearbeiten') }} @@ -25,7 +25,15 @@

{!! Form::open(['url' => route('admin_lead_store'), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!} - @if(!$user->id || $user->id == 'new') + +
+   + {{ __('back') }} +
+ + @include('admin.lead.m_data_form') + + @if(!$user->id || $user->id === 'new') @include('user.user_new_form') @include('user.data_verify') @else @@ -34,7 +42,7 @@
  - {{ __('abort') }} + {{ __('back') }}
{!! Form::close() !!} diff --git a/resources/views/admin/leads.blade.php b/resources/views/admin/lead/index.blade.php similarity index 93% rename from resources/views/admin/leads.blade.php rename to resources/views/admin/lead/index.blade.php index 5570b56..28650c5 100644 --- a/resources/views/admin/leads.blade.php +++ b/resources/views/admin/lead/index.blade.php @@ -46,8 +46,8 @@ "columns": [ {data: 'action', orderable: false, searchable: false}, { data: 'email', name: 'email' }, - { data: 'first_name', name: 'account.first_name' }, - { data: 'last_name', name: 'account.last_name' }, + { data: 'first_name', name: 'first_name' }, + { data: 'last_name', name: 'last_name' }, { data: 'confirmed', name: 'confirmed' }, { data: 'active', name: 'active' }, { data: 'agreement', name: 'agreement' } diff --git a/resources/views/admin/lead/m_data_form.blade.php b/resources/views/admin/lead/m_data_form.blade.php new file mode 100644 index 0000000..26e7f4f --- /dev/null +++ b/resources/views/admin/lead/m_data_form.blade.php @@ -0,0 +1,40 @@ +
+
+ {{ __('mivita interne Daten') }} +
+
+
+
+ + {{ Form::text('m_account', $user->account->m_account, array('placeholder'=>__(' Account ID'), 'class'=>'form-control', 'id'=>'m_account', 'required'=>true)) }} +
+
+ + +
+
+
+
+ + +
+ +
+ + {{ Form::text('m_first_name', $user->account->m_first_name, array('placeholder'=>__('First name'), 'class'=>'form-control', 'id'=>'m_first_name', 'required'=>true)) }} +
+
+ + {{ Form::text('m_last_name', $user->account->m_last_name, array('placeholder'=>__('Last Name'), 'class'=>'form-control', 'id'=>'m_last_name', 'required'=>true)) }} +
+
+
+ + {{ Form::textarea('m_notes', $user->account->m_notes , array('placeholder'=>__('weitere Daten'), 'class'=>'form-control', 'id'=>'m_notes', 'rows'=>4)) }} +
+
+
\ No newline at end of file diff --git a/resources/views/admin/level/index.blade.php b/resources/views/admin/level/index.blade.php new file mode 100755 index 0000000..acbea8c --- /dev/null +++ b/resources/views/admin/level/index.blade.php @@ -0,0 +1,155 @@ +@extends('layouts.layout-2') + +@section('content') +
+
+ {{__('Karriere-Level')}} +
+
+ + + + + + + + + + + + + @foreach($values as $value) + + + + + + + + + + + @endforeach + +
 {{__('Pos')}}{{__('Description')}}{{__('Marge') }}{{__('Translate') }}{{__('Status')}}
+ + {{ $value->pos }}{{ $value->name }}{{ $value->getFormattedMargin() }}{{ $value->getTranNames() }}@if($value->active) @else@endif
+
+ +
+
+ +
+ + + + + + + +@endsection diff --git a/resources/views/admin/product/form.blade.php b/resources/views/admin/product/form.blade.php index 6b9dca7..39b4839 100755 --- a/resources/views/admin/product/form.blade.php +++ b/resources/views/admin/product/form.blade.php @@ -63,37 +63,42 @@
-
+
{{ Form::text('price', $product->getFormattedPrice(), array('placeholder'=>__('price'), 'class'=>'form-control', 'id'=>'price')) }}
-
+
{{ Form::text('price_ek', $product->getFormattedPriceEk(), array('placeholder'=>__('price_ek'), 'class'=>'form-control', 'id'=>'price_ek')) }}
-
+
{{ Form::text('tax', $product->getFormattedTax(), array('placeholder'=>__('tax'), 'class'=>'form-control', 'id'=>'tax')) }}
-
-
-
+
{{ Form::text('price_old', $product->getFormattedPriceOld(), array('placeholder'=>__('price_old'), 'class'=>'form-control', 'id'=>'price_old')) }}
-
- - {{ Form::text('amount', $product->amount, array('placeholder'=>__('amount'), 'class'=>'form-control', 'id'=>'amount')) }} +
+
-
{{ Form::text('weight', $product->weight, array('placeholder'=>__('Gewicht in g'), 'class'=>'form-control', 'id'=>'weight')) }}
+
+ + {{ Form::text('points', $product->points, array('placeholder'=>__('Points pro Produkt'), 'class'=>'form-control', 'id'=>'points')) }} +
+
+ + {{ Form::text('amount', $product->amount, array('placeholder'=>__('amount'), 'class'=>'form-control', 'id'=>'amount')) }} + +
diff --git a/resources/views/admin/product/index.blade.php b/resources/views/admin/product/index.blade.php index 0bc1e8c..1a8c9f7 100755 --- a/resources/views/admin/product/index.blade.php +++ b/resources/views/admin/product/index.blade.php @@ -40,7 +40,8 @@ @endforeach @if($value->active) @else@endif - +   + @endforeach @@ -61,13 +62,13 @@ "bLengthChange": false, "iDisplayLength": 50, "aoColumns": [ - { "sWidth": "8%" }, + { "sWidth": "6%" }, { "sWidth": "8%" }, { "sWidth": "19%" }, { "sWidth": "19%" }, { "sWidth": "30%" }, { "sWidth": "10%" }, - { "sWidth": "8%" }, + { "sWidth": "10%" }, ], "language": { "url": "/js/German.json" diff --git a/resources/views/admin/user_edit.blade.php b/resources/views/admin/user/edit.blade.php similarity index 100% rename from resources/views/admin/user_edit.blade.php rename to resources/views/admin/user/edit.blade.php diff --git a/resources/views/admin/users.blade.php b/resources/views/admin/user/index.blade.php similarity index 100% rename from resources/views/admin/users.blade.php rename to resources/views/admin/user/index.blade.php diff --git a/resources/views/layouts/includes/layout-sidenav.blade.php b/resources/views/layouts/includes/layout-sidenav.blade.php index ab7ced7..2ca9961 100755 --- a/resources/views/layouts/includes/layout-sidenav.blade.php +++ b/resources/views/layouts/includes/layout-sidenav.blade.php @@ -88,10 +88,19 @@
  • {{ __('User Rechte') }}
  • -
  • {{ __('Versandkosten') }}
  • +
  • +
    {{ __(' Karriere-Level') }}
    +
  • + +
  • +
    {{ __('Länder') }}
    +
  • + + + @endif @if(Auth::user()->isSySAdmin()) diff --git a/resources/views/user/user_form.blade.php b/resources/views/user/user_form.blade.php index db857ff..5181b3a 100644 --- a/resources/views/user/user_form.blade.php +++ b/resources/views/user/user_form.blade.php @@ -159,23 +159,30 @@
    - - {{ Form::text('tax_number', $user->account->tax_number, array('placeholder'=>__('Steuernummer'), 'class'=>'form-control', 'id'=>'tax_number')) }} + + {{ Form::text('tax_number', $user->account->tax_number, array('placeholder'=>__('Steuernummer'), 'class'=>'form-control', 'id'=>'tax_number', $user->account->getCountryAttrAs('tax_number','required'))) }}
    - - {{ Form::text(' tax_identification_number', $user->account-> tax_identification_number, array('placeholder'=>__('USt-ID Nummer'), 'class'=>'form-control', 'id'=>' tax_identification_number')) }} + + {{ Form::text(' tax_identification_number', $user->account-> tax_identification_number, array('placeholder'=>__('USt-ID Nummer'), 'class'=>'form-control', 'id'=>' tax_identification_number', $user->account->getCountryAttrAs('tax_id_number','required'))) }} +
    +
    + + +
    -
    - -
    +
    - +
    + +
    {{ __('Versand Adresse') }} diff --git a/resources/views/user/user_new_form.blade.php b/resources/views/user/user_new_form.blade.php index bcb176e..dc3951a 100644 --- a/resources/views/user/user_new_form.blade.php +++ b/resources/views/user/user_new_form.blade.php @@ -1,3 +1,4 @@ +
    {{ __('Rechnungsdaten') }} @@ -11,7 +12,6 @@
    -