From 436f550117fef6d8bcff41e5371fb9a49923ec08 Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Fri, 16 Oct 2020 16:18:00 +0200 Subject: [PATCH] + Homparty Part 1 --- .idea/workspace.xml | 87 ++++-- .../Controllers/User/HomepartyController.php | 269 ++++++++++++++++++ .../Controllers/Web/HomepartyController.php | 96 +++++++ app/Models/Homeparty.php | 120 ++++++++ app/Models/HomepartyUser.php | 192 +++++++++++++ app/Models/Logger.php | 18 +- app/Models/ShippingCountry.php | 2 + app/Models/ShippingPrice.php | 4 + app/Models/ShoppingInstance.php | 4 + app/Models/ShoppingOrder.php | 12 + app/Models/ShoppingOrderItem.php | 4 + app/Models/ShoppingUser.php | 10 + app/Models/SySetting.php | 17 +- app/Services/Util.php | 12 + ..._10_15_151059_create_homeparties_table.php | 44 +++ ...15_151136_create_homeparty_users_table.php | 95 +++++++ resources/lang/de/navigation.php | 2 + resources/lang/de/validation.php | 1 + .../views/admin/customer/_edit.blade.php | 6 +- .../admin/lead/m_data_form_edit.blade.php | 4 +- .../includes/layout-navbar-without.blade.php | 7 + .../layouts/includes/layout-navbar.blade.php | 2 +- .../layouts/includes/layout-sidenav.blade.php | 13 + .../views/layouts/layout-2-without.blade.php | 74 +++++ resources/views/user/_user_form.blade.php | 8 +- resources/views/user/customer/add.blade.php | 1 - resources/views/user/form.blade.php | 4 +- .../views/user/homeparty/_edit.blade.php | 234 +++++++++++++++ .../views/user/homeparty/detail.blade.php | 241 ++++++++++++++++ .../user/homeparty/guest_detail.blade.php | 141 +++++++++ .../views/user/homeparty/guests.blade.php | 109 +++++++ .../views/user/homeparty/index.blade.php | 79 +++++ .../homeparty/self_guest_detail.blade.php | 134 +++++++++ .../user/order/_bak_shipping_me.blade.php | 4 +- .../user/order/_bak_shipping_ot.blade.php | 4 +- resources/views/user/team/members.blade.php | 1 - resources/views/user/user_form.blade.php | 4 +- .../views/web/templates/kontakt.blade.php | 4 +- .../web/templates/registrierung.blade.php | 4 +- routes/web.php | 18 ++ 40 files changed, 2027 insertions(+), 58 deletions(-) create mode 100755 app/Http/Controllers/User/HomepartyController.php create mode 100755 app/Http/Controllers/Web/HomepartyController.php create mode 100644 app/Models/Homeparty.php create mode 100644 app/Models/HomepartyUser.php create mode 100644 database/migrations/2020_10_15_151059_create_homeparties_table.php create mode 100644 database/migrations/2020_10_15_151136_create_homeparty_users_table.php create mode 100755 resources/views/layouts/includes/layout-navbar-without.blade.php create mode 100755 resources/views/layouts/layout-2-without.blade.php create mode 100644 resources/views/user/homeparty/_edit.blade.php create mode 100644 resources/views/user/homeparty/detail.blade.php create mode 100644 resources/views/user/homeparty/guest_detail.blade.php create mode 100644 resources/views/user/homeparty/guests.blade.php create mode 100644 resources/views/user/homeparty/index.blade.php create mode 100644 resources/views/user/homeparty/self_guest_detail.blade.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6f062def..b59f6578 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,14 +5,45 @@ + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -266,16 +304,9 @@ - - - - - - - - + @@ -301,11 +332,6 @@ - - - - - @@ -532,6 +558,11 @@ + + + + + @@ -568,10 +599,11 @@ - + + @@ -613,24 +645,21 @@ - - - - - + - + - + + diff --git a/app/Http/Controllers/User/HomepartyController.php b/app/Http/Controllers/User/HomepartyController.php new file mode 100755 index 00000000..354d7077 --- /dev/null +++ b/app/Http/Controllers/User/HomepartyController.php @@ -0,0 +1,269 @@ +middleware('superadmin'); + + $this->middleware('active.account'); + } + + public function index() + { + $data = [ + 'homepartys' => Homeparty::where('auth_user_id', '=', \Auth::user()->id)->get(), + ]; + return view('user.homeparty.index', $data); + } + + public function detail($id) + { + if($id === 'new'){ + $homeparty = new Homeparty(); + }else{ + $homeparty = $this->getHomparty($id); + } + if($homeparty->homeparty_host){ + $homeparty_user = $homeparty->homeparty_host; + }else{ + $homeparty_user = new HomepartyUser(); + $homeparty_user->is_host = true; + } + $data = [ + 'homeparty' => $homeparty, + 'homeparty_user' => $homeparty_user, + + ]; + return view('user.homeparty.detail', $data); + } + + public function store($id = null) + { + $data = Request::all(); + if($data['action'] === 'homeparty-party-store'){ + $rules = array( + 'date' => 'required', + 'name' => 'required', + 'place' => 'required' + ); + } + if($data['action'] === 'homeparty-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()); + } + + if($data['action'] === 'homeparty-party-store'){ + if(!$id){ + //first save create and empty user/host + $homeparty = Homeparty::create($data); + do { + $token = Util::uuidToken(); + } while( HomepartyUser::where('token', $token)->count() ); + $homeparty_user = HomepartyUser::create([ + 'homeparty_id' => $homeparty->id, + 'auth_user_id' => \Auth::user()->id, + 'is_host' => true, + 'token' => $token, + ]); + }else { + $homeparty = $this->getHomparty($id); + $homeparty->fill($data)->save(); + } + } + + if($data['action'] === 'homeparty-user-store'){ + $homeparty = $this->getHomparty($id); + $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']; + $homeparty_user = $homeparty->homeparty_host; + $homeparty_user->fill($data)->save(); + } + + \Session()->flash('alert-save', '1'); + return redirect(route('user_homeparty_detail', $homeparty->id)); + } + + + public function guests($id = null) + { + $homeparty = $this->getHomparty($id); + $data = [ + 'homeparty' => $homeparty, + ]; + return view('user.homeparty.guests', $data); + } + + + public function guestDetail($id = null, $gid = null) + { + $homeparty = $this->getHomparty($id); + if($gid === 'new'){ + do { + $token = Util::uuidToken(); + } while( HomepartyUser::where('token', $token)->count() ); + $homeparty_user = HomepartyUser::create([ + 'homeparty_id' => $homeparty->id, + 'auth_user_id' => \Auth::user()->id, + 'is_host' => false, + 'token' => $token, + ]); + }else{ + $homeparty_user = HomepartyUser::findOrFail($gid); + if($homeparty->id !== $homeparty_user->homeparty_id){ + abort(404); + } + } + $data = [ + 'homeparty' => $homeparty, + 'homeparty_user' => $homeparty_user, + ]; + return view('user.homeparty.guest_detail', $data); + } + + public function guestStore($id = null, $gid = null) + { + $data = Request::all(); + $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()); + } + + $homeparty = $this->getHomparty($id); + $homeparty_user = HomepartyUser::findOrFail($gid); + if($homeparty->id !== $homeparty_user->homeparty_id){ + abort(404); + } + $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']; + $homeparty_user->fill($data)->save(); + \Session()->flash('alert-save', '1'); + return redirect(route('user_homeparty_guests', [$homeparty->id])); + } + + + public function order($id = null) + { + $homeparty = $this->getHomparty($id); + abort(404); + + /*$shopping_order = ShoppingOrder::findOrFail($id); + if($shopping_order->auth_user_id !== $user->id){ + abort(404); + } + $shopping_order->getLastShoppingPayment(); + + $data = [ + 'shopping_order' => $shopping_order, + 'isAdmin' => false, + ]; + return view('user.order.detail', $data);*/ + } + + public function delete($do, $id = null, $gid=null) + { + $homeparty = $this->getHomparty($id); + + if($do === 'hpu'){ + $homeparty_user = HomepartyUser::findOrFail($gid); + if($homeparty->id !== $homeparty_user->homeparty_id){ + abort(404); + } + $homeparty_user->token = null; + $homeparty_user->save(); + $homeparty_user->delete(); + \Session()->flash('alert-success', "Homeparty Gast gelöscht"); + return redirect(route('user_homeparty_guests', [$homeparty->id])); + + } + if($do === 'hp') { + + foreach ($homeparty->homeparty_users as $homeparty_user){ + if ($homeparty->id !== $homeparty_user->homeparty_id) { + abort(404); + } + $homeparty_user->token = null; + $homeparty_user->save(); + $homeparty_user->delete(); + } + $homeparty->delete(); + \Session()->flash('alert-success', "Homeparty gelöscht"); + return redirect(route('user_homepartys')); + + } + abort(404); + } + + private function getHomparty($id){ + $homeparty = Homeparty::findOrFail($id); + if($homeparty->auth_user_id !== \Auth::user()->id){ + abort(404); + } + return $homeparty; + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Web/HomepartyController.php b/app/Http/Controllers/Web/HomepartyController.php new file mode 100755 index 00000000..964c14eb --- /dev/null +++ b/app/Http/Controllers/Web/HomepartyController.php @@ -0,0 +1,96 @@ +where('token_active', true)->first(); + + if(!$homeparty_user){ + abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.'); + } + $data = [ + 'homeparty' => $homeparty_user->homeparty, + 'homeparty_user' => $homeparty_user, + ]; + + return view('user.homeparty.self_guest_detail', $data); + } + + + + + public function detailStore($token = null) + { + if(!$token){ + abort(404); + } + $homeparty_user = HomepartyUser::where('token', $token)->where('token_active', true)->first(); + + if(!$homeparty_user){ + abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.'); + } + + + + $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 = Request::all(); + $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']; + $homeparty_user->fill($data)->save(); + \Session()->flash('alert-save', '1'); + return redirect(route('homeparty', [$token])); + } +} \ No newline at end of file diff --git a/app/Models/Homeparty.php b/app/Models/Homeparty.php new file mode 100644 index 00000000..97dd9b0e --- /dev/null +++ b/app/Models/Homeparty.php @@ -0,0 +1,120 @@ + 'int', + 'completed' => 'int', + 'status' => 'int', + 'order_to' => 'bool', + 'active' => 'bool', + 'default' => 'bool' + ]; + + protected $dates = [ + 'date' + ]; + + protected $fillable = [ + 'auth_user_id', + 'date', + 'name', + 'place', + 'description', + 'pos', + 'completed', + 'status', + 'order_to', + 'active', + 'default' + ]; + + public function auth_user() + { + return $this->belongsTo('App\User', 'auth_user_id'); + } + + public function homeparty_users() + { + return $this->hasMany('App\Models\HomepartyUser', 'homeparty_id'); + } + + public function homeparty_host() + { + return $this->hasOne('App\Models\HomepartyUser', 'homeparty_id')->where('is_host', true); + } + + public function homeparty_guests() + { + return $this->hasMany('App\Models\HomepartyUser', 'homeparty_id')->where('is_host', false); + } + + + public function getDateAttribute($value) + { + if (!$value) { + return ""; + } + return Carbon::parse($value)->format(\Util::formatDateDB()); + } + + public function setDateAttribute($value) + { + $this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL; + } +} + diff --git a/app/Models/HomepartyUser.php b/app/Models/HomepartyUser.php new file mode 100644 index 00000000..e91751d4 --- /dev/null +++ b/app/Models/HomepartyUser.php @@ -0,0 +1,192 @@ + 'int', + 'auth_user_id' => 'int', + 'is_host' => 'bool', + 'billing_country_id' => 'int', + 'same_as_billing' => 'bool', + 'shipping_country_id' => 'int', + 'has_buyed' => 'bool', + 'subscribed' => 'bool', + 'token_active' => 'bool' + ]; + + protected $dates = [ + 'user_deleted_at' + ]; + + protected $hidden = [ + 'token' + ]; + + protected $fillable = [ + 'homeparty_id', + 'auth_user_id', + 'is_host', + 'billing_salutation', + 'billing_company', + 'billing_firstname', + 'billing_lastname', + 'billing_address', + 'billing_address_2', + 'billing_zipcode', + 'billing_city', + 'billing_country_id', + 'billing_phone', + 'billing_email', + 'same_as_billing', + 'shipping_salutation', + 'shipping_company', + 'shipping_firstname', + 'shipping_lastname', + 'shipping_address', + 'shipping_address_2', + 'shipping_zipcode', + 'shipping_city', + 'shipping_country_id', + 'shipping_phone', + 'shipping_email', + 'has_buyed', + 'subscribed', + 'token', + 'token_active', + 'notice', + 'mode', + 'user_deleted_at' + ]; + + public function homeparty() + { + return $this->belongsTo(Homeparty::class); + } + + public function auth_user() + { + return $this->belongsTo(User::class, 'auth_user_id'); + } + + public function billing_country() + { + return $this->belongsTo('App\Models\Country','billing_country_id'); + } + + public function shipping_country() + { + return $this->belongsTo('App\Models\Country','shipping_country_id'); + } + + public function getTokenLink(){ + return url('homeparty/'.$this->token); + } + + +} diff --git a/app/Models/Logger.php b/app/Models/Logger.php index b65aca7b..ad84cc11 100644 --- a/app/Models/Logger.php +++ b/app/Models/Logger.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class Logger - * + * * @property int $id * @property int $user_id * @property int $model_id @@ -23,10 +23,22 @@ use Illuminate\Database\Eloquent\Model; * @property int $level * @property Carbon $created_at * @property Carbon $updated_at - * * @property User $user - * * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereAction($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereChannel($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereLevel($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereMessage($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModel($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModelId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUpdatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUserId($value) + * @mixin \Eloquent */ class Logger extends Model { diff --git a/app/Models/ShippingCountry.php b/app/Models/ShippingCountry.php index cabe7315..c7733a6d 100644 --- a/app/Models/ShippingCountry.php +++ b/app/Models/ShippingCountry.php @@ -23,6 +23,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereShippingId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereUpdatedAt($value) * @mixin \Eloquent + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders + * @property-read int|null $shopping_orders_count */ class ShippingCountry extends Model { diff --git a/app/Models/ShippingPrice.php b/app/Models/ShippingPrice.php index c642293f..724ee3b8 100644 --- a/app/Models/ShippingPrice.php +++ b/app/Models/ShippingPrice.php @@ -37,6 +37,10 @@ use Illuminate\Database\Eloquent\Model; * @mixin \Eloquent * @property-write mixed $tax * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTaxRate($value) + * @property float|null $price_comp + * @property int|null $num_comp + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereNumComp($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePriceComp($value) */ class ShippingPrice extends Model { diff --git a/app/Models/ShoppingInstance.php b/app/Models/ShoppingInstance.php index 3dc0c318..225d7278 100644 --- a/app/Models/ShoppingInstance.php +++ b/app/Models/ShoppingInstance.php @@ -30,6 +30,10 @@ use Illuminate\Database\Eloquent\Model; * @mixin \Eloquent * @property int|null $payment * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance wherePayment($value) + * @property array|null $shopping_data + * @property string|null $back + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereBack($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereShoppingData($value) */ class ShoppingInstance extends Model { diff --git a/app/Models/ShoppingOrder.php b/app/Models/ShoppingOrder.php index 218d6248..57431b81 100644 --- a/app/Models/ShoppingOrder.php +++ b/app/Models/ShoppingOrder.php @@ -68,6 +68,18 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withTrashed() * @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed() * @property-read \App\Models\ShippingCountry $shipping_country + * @property float|null $shipping_net + * @property float|null $subtotal_ws + * @property int|null $points + * @property int|null $shipped + * @property string|null $tracking + * @property string|null $wp_invoice_path + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePoints($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShipped($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereShippingNet($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereSubtotalWs($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereTracking($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value) */ class ShoppingOrder extends Model { diff --git a/app/Models/ShoppingOrderItem.php b/app/Models/ShoppingOrderItem.php index 450c9b4d..0f6372e8 100644 --- a/app/Models/ShoppingOrderItem.php +++ b/app/Models/ShoppingOrderItem.php @@ -41,6 +41,10 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUserDeletedAt($value) * @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withTrashed() * @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withoutTrashed() + * @property int|null $comp + * @property float|null $price_net + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereComp($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem wherePriceNet($value) */ class ShoppingOrderItem extends Model { diff --git a/app/Models/ShoppingUser.php b/app/Models/ShoppingUser.php index c01721c8..da6b78ff 100644 --- a/app/Models/ShoppingUser.php +++ b/app/Models/ShoppingUser.php @@ -103,6 +103,16 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingUser withoutTrashed() * @property string|null $mode * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereMode($value) + * @property bool|null $faker_mail + * @property string|null $shipping_email + * @property string|null $is_for + * @property string|null $is_from + * @property int|null $shopping_user_id + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereFakerMail($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFor($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFrom($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingEmail($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShoppingUserId($value) */ class ShoppingUser extends Model { diff --git a/app/Models/SySetting.php b/app/Models/SySetting.php index 6c51cc6a..852f0465 100644 --- a/app/Models/SySetting.php +++ b/app/Models/SySetting.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class SySetting - * + * * @property int $id * @property string $name * @property string $slug @@ -22,8 +22,21 @@ use Illuminate\Database\Eloquent\Model; * @property bool $active * @property Carbon $created_at * @property Carbon $updated_at - * * @package App\Models + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting findSimilarSlugs($attribute, $config, $slug) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereAction($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereActive($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereMessage($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereName($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereSlug($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereStatus($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereUpdatedAt($value) + * @mixin \Eloquent */ class SySetting extends Model { diff --git a/app/Services/Util.php b/app/Services/Util.php index ae5a5587..d4f4a90b 100644 --- a/app/Services/Util.php +++ b/app/Services/Util.php @@ -2,6 +2,7 @@ namespace App\Services; use App\Models\UserHistory; +use Illuminate\Support\Str; use Yard; class Util @@ -16,6 +17,17 @@ class Util return hash_hmac('sha256', str_random(40), config('app.key')); } + public static function uuidToken() + { + $uuid = (string) Str::uuid(); + $e_uuid = explode("-", $uuid); + if(isset($e_uuid[0]) && $e_uuid[1]){ + return $e_uuid[0]."-".$e_uuid[1]; + + } + return $uuid; + } + public static function formatDate(){ if(\App::getLocale() === "en"){ return 'yyyy-mm-dd'; diff --git a/database/migrations/2020_10_15_151059_create_homeparties_table.php b/database/migrations/2020_10_15_151059_create_homeparties_table.php new file mode 100644 index 00000000..80a4ed9f --- /dev/null +++ b/database/migrations/2020_10_15_151059_create_homeparties_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->date('date'); + $table->string('name')->nullable(); + $table->string('place')->nullable(); + $table->text('description')->nullable(); + + $table->unsignedTinyInteger('pos')->default(0); + $table->unsignedTinyInteger('completed')->default(0); + $table->unsignedTinyInteger('status')->default(0); + + $table->boolean('order_to')->default(true); + $table->boolean('active')->default(false); + $table->boolean('default')->default(false); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('homeparties'); + } +} diff --git a/database/migrations/2020_10_15_151136_create_homeparty_users_table.php b/database/migrations/2020_10_15_151136_create_homeparty_users_table.php new file mode 100644 index 00000000..e02898d3 --- /dev/null +++ b/database/migrations/2020_10_15_151136_create_homeparty_users_table.php @@ -0,0 +1,95 @@ +increments('id'); + + $table->unsignedInteger('homeparty_id'); + $table->unsignedInteger('auth_user_id'); + + $table->boolean('is_host')->default(false); + + $table->char('billing_salutation', 2)->nullable(); + $table->string('billing_company')->nullable(); + $table->string('billing_firstname')->nullable(); + $table->string('billing_lastname')->nullable(); + $table->string('billing_address')->nullable(); + $table->string('billing_address_2')->nullable(); + $table->string('billing_zipcode')->nullable(); + $table->string('billing_city')->nullable(); + $table->unsignedInteger('billing_country_id'); + $table->string('billing_phone')->nullable(); + $table->string('billing_email')->nullable(); + + + $table->boolean('same_as_billing')->default(true); + $table->char('shipping_salutation', 2)->nullable(); + $table->string('shipping_company')->nullable(); + $table->string('shipping_firstname')->nullable(); + $table->string('shipping_lastname')->nullable(); + $table->string('shipping_address')->nullable(); + $table->string('shipping_address_2')->nullable(); + $table->string('shipping_zipcode')->nullable(); + $table->string('shipping_city')->nullable(); + $table->unsignedInteger('shipping_country_id'); + $table->string('shipping_phone')->nullable(); + $table->string('shipping_email')->nullable(); + + $table->boolean('has_buyed')->default(false); + $table->boolean('subscribed')->default(false); + + $table->string('token')->nullable(); + $table->boolean('token_active')->default(true); + + $table->text('notice')->nullable(); + + $table->char('mode', 4)->nullable(); + + $table->timestamps(); + $table->softDeletes(); + $table->timestamp('user_deleted_at')->nullable(); + + + $table->foreign('billing_country_id') + ->references('id') + ->on('countries'); + + $table->foreign('shipping_country_id') + ->references('id') + ->on('countries'); + + $table->foreign('auth_user_id') + ->references('id') + ->on('users'); + + $table->foreign('homeparty_id') + ->references('id') + ->on('homeparties') + ->onDelete('cascade'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('homeparty_users'); + } +} diff --git a/resources/lang/de/navigation.php b/resources/lang/de/navigation.php index 8e914da5..fb905efe 100755 --- a/resources/lang/de/navigation.php +++ b/resources/lang/de/navigation.php @@ -10,6 +10,7 @@ return [ 'my_team' => 'Mein Team', 'my_clients' => 'Meine Kunden', 'my_orders' => 'Meine Bestellungen', + 'my_homeparty' => 'Meine Homeparty', 'member_register' => 'Berater registrieren', 'member'=>'Berater', 'membership' => 'Mitgliedschaft', @@ -29,6 +30,7 @@ return [ 'general'=>'Allgemein', 'modules'=>'Module', 'user_roles'=>'User Rechte', + 'manage'=>'verwalten', 'shipping_costs'=>'Versandkosten', 'payment_methods' => 'Zahlungsarten', 'career_level'=>'Karriere-Level', diff --git a/resources/lang/de/validation.php b/resources/lang/de/validation.php index fc3eb65a..74cc1518 100755 --- a/resources/lang/de/validation.php +++ b/resources/lang/de/validation.php @@ -154,6 +154,7 @@ return [ 'attributes' => [ 'salutation' => 'Anrede', 'name' => 'Name', + 'place' => 'Ort', 'username' => 'Benutzername', 'email' => 'E-Mail-Adresse', 'email-confirm' => 'E-Mail-Adresse wiederholen', diff --git a/resources/views/admin/customer/_edit.blade.php b/resources/views/admin/customer/_edit.blade.php index 246cf276..9d18bddc 100644 --- a/resources/views/admin/customer/_edit.blade.php +++ b/resources/views/admin/customer/_edit.blade.php @@ -124,7 +124,7 @@
-
+
+ {!! HTMLHelper::getSalutation($homeparty_user->billing_salutation) !!} + + @if ($errors->has('billing_salutation')) + + {{ $errors->first('billing_salutation') }} + + @endif +
+
+
+
+ + {{ Form::text('billing_firstname', $homeparty_user->billing_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'id'=>'billing_firstname', 'required'=>true, 'tabindex' => 4)) }} + @if ($errors->has('billing_firstname')) + + {{ $errors->first('billing_firstname') }} + + @endif + +
+
+ + {{ Form::text('billing_lastname', $homeparty_user->billing_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'id'=>'billing_lastname', 'required'=>true, 'tabindex' => 5)) }} + @if ($errors->has('billing_lastname')) + + {{ $errors->first('billing_lastname') }} + + @endif + +
+
+
+
+ + {{ Form::text('billing_address', $homeparty_user->billing_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_address', 'tabindex' => 6)) }} + @if ($errors->has('billing_address')) + + {{ $errors->first('billing_address') }} + + @endif +
+
+
+
+ + {{ Form::text('billing_address_2', $homeparty_user->billing_address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control', 'id'=>'billing_address_2', 'tabindex' => 6)) }} +
+
+
+
+ + {{ Form::text('billing_zipcode', $homeparty_user->billing_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_zipcode', 'tabindex' => 7)) }} + @if ($errors->has('billing_zipcode')) + + {{ $errors->first('billing_zipcode') }} + + @endif +
+
+ + {{ Form::text('billing_city', $homeparty_user->billing_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_city', 'tabindex' => 8)) }} + @if ($errors->has('billing_city')) + + {{ $errors->first('billing_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('billing_country_id')) + + {{ $errors->first('billing_country_id') }} + + @endif +
+
+
+
+ + {{ Form::text('billing_phone', $homeparty_user->billing_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control', 'id'=>'billing_phone', 'tabindex' => 11)) }} +
+
+
+
+ + {{ Form::text('billing_email', $homeparty_user->billing_email, array('placeholder'=>'E-Mail', 'class'=>'form-control', 'id'=>'billing_email', 'tabindex' => 12)) }} +
+
+
+
+
+
+
Lieferadresse
+
+
+
+
+ + {{ Form::text('shipping_company', $homeparty_user->shipping_company, array('placeholder'=>__('Company name'), 'class'=>'form-control', 'id'=>'shipping_company', 'tabindex' => 16)) }} +
+
+
+
+ + + @if ($errors->has('shipping_salutation')) + + {{ $errors->first('shipping_salutation') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_firstname', $homeparty_user->shipping_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_firstname', 'tabindex' => 18)) }} + @if ($errors->has('shipping_firstname')) + + {{ $errors->first('shipping_firstname') }} + + @endif +
+
+ + {{ Form::text('shipping_lastname', $homeparty_user->shipping_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_lastname', 'tabindex' => 19)) }} + @if ($errors->has('shipping_lastname')) + + {{ $errors->first('shipping_lastname') }} + + @endif + +
+
+
+
+ + {{ Form::text('shipping_address', $homeparty_user->shipping_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_address', 'tabindex' => 20)) }} + @if ($errors->has('shipping_address')) + + {{ $errors->first('shipping_address') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_address_2', $homeparty_user->shipping_address_2, array('placeholder'=>__('Wohnung / Gebäude (optional)'), 'class'=>'form-control', 'id'=>'shipping_address_2', 'tabindex' => 21)) }} + @if ($errors->has('shipping_address_2')) + + {{ $errors->first('shipping_address_2') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_zipcode', $homeparty_user->shipping_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_zipcode', 'tabindex' => 22)) }} + @if ($errors->has('shipping_zipcode')) + + {{ $errors->first('shipping_zipcode') }} + + @endif + +
+
+ + {{ Form::text('shipping_city', $homeparty_user->shipping_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_city', 'tabindex' => 23)) }} + @if ($errors->has('shipping_city')) + + {{ $errors->first('shipping_city') }} + + @endif +
+
+
+
+ + + @if ($errors->has('shipping_country_id')) + + {{ $errors->first('shipping_country_id') }} + + @endif +
+
+
+
+ + {{ Form::text('shipping_phone', $homeparty_user->shipping_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control', 'id'=>'shipping_phone', 'tabindex' => 26)) }} +
+
+
+
+ + {{ Form::text('shipping_email', $homeparty_user->shipping_email, array('placeholder'=>'E-Mail', 'class'=>'form-control', 'id'=>'shipping_email', 'tabindex' => 27)) }} +
+
+
+
+ +
+
+
+ + {{ Form::hidden('is_host', $homeparty_user->is_host) }} + \ No newline at end of file diff --git a/resources/views/user/homeparty/detail.blade.php b/resources/views/user/homeparty/detail.blade.php new file mode 100644 index 00000000..e20b4c16 --- /dev/null +++ b/resources/views/user/homeparty/detail.blade.php @@ -0,0 +1,241 @@ +@extends('layouts.layout-2') + +@section('content') +

+
{{ __('navigation.my_homeparty') }} / + @if(!$homeparty->id) + anlegen + @else + {{ __('navigation.manage') }} + + @endif +
+ zurück +

+ + {!! Form::open(['url' => route('user_homeparty_detail', [$homeparty->id]), 'class' => 'form-horizontal', 'id'=>'homeparty-party-form-validation']) !!} + +
+
+
+ @if(!$homeparty->id) +
+ Neue Homeparty anlegen +
+ @else +
+
+
Homeparty verwalten
+ +
+
+ @endif +
+
+ +
+
+
+ + {{ Form::text('name', $homeparty->name, array('placeholder'=>__('Veranstaltungsname'), 'class'=>'form-control', 'required')) }} + @if ($errors->has('name')) + + {{ $errors->first('name') }} + + @endif +
+
+ + {{ Form::text('date', $homeparty->date, array('placeholder'=>Util::formatDate(), 'data-date-format'=>Util::formatDate(), 'data-start_view'=>2, 'class'=>'form-control datepicker-base', 'required')) }} + @if ($errors->has('date')) + + {{ $errors->first('date') }} + + @endif +
+
+ + {{ Form::text('place', $homeparty->place, array('placeholder'=>__('Veranstaltungsort'), 'class'=>'form-control', 'required')) }} + @if ($errors->has('place')) + + {{ $errors->first('place') }} + + @endif +
+ +
+
+ + {{ Form::textarea('description', $homeparty->description , array('placeholder'=>__('Beschreibung'), 'class'=>'form-control', 'rows'=>2)) }} +
+
+
+
+   + zurück zur Übersicht +
+ {!! Form::close() !!} + + + @if($homeparty->id) + {!! Form::open(['url' => route('user_homeparty_detail', [$homeparty->id]), 'class' => 'form-horizontal', 'id'=>'homeparty-user-form-validation']) !!} +
+
+
+
Lass den Gastgeber seine Daten selber ausfüllen
+
+
+ + + + +
+
+

Teile diesen Link mit dem Gastgeber (z.B. WhatsApp oder SMS), damit gelangt er auf eine Zielseite wo er seine Daten selber ausfüllen kann. Nutze das „Kopier-Symbol“, um den Link gleich in Deine Zwischenablage zu kopieren.

+
+
+
+
+
+ Gastgeber-, Rechungsadresse +
+
+ * {{trans('register.required_fields')}} + Lieferadresse +
+
+
+ @include('user.homeparty._edit') +
+
+   + zurück zur Übersicht +
+ {!! Form::close() !!} + @endif + + + + + +@endsection \ No newline at end of file diff --git a/resources/views/user/homeparty/guest_detail.blade.php b/resources/views/user/homeparty/guest_detail.blade.php new file mode 100644 index 00000000..b59a3b65 --- /dev/null +++ b/resources/views/user/homeparty/guest_detail.blade.php @@ -0,0 +1,141 @@ +@extends('layouts.layout-2') + +@section('content') +

+
{{ __('navigation.my_homeparty') }} / {{ $homeparty->name }} - {{ $homeparty->date }}
+ zurück +

+ + {!! Form::open(['url' => route('user_homeparty_guest_detail', [$homeparty->id, $homeparty_user->id]), 'class' => 'form-horizontal', 'id'=>'homeparty-user-form-validation']) !!} +
+
+
+
Lass den @if($homeparty_user->is_host) Gastgeber @else Gast @endif seine Daten selber ausfüllen
+
+
+ + + + +
+
+

Teile diesen Link mit dem Gastgeber (z.B. WhatsApp oder SMS), damit gelangt er auf eine Zielseite wo er seine Daten selber ausfüllen kann. Nutze das „Kopier-Symbol“, um den Link gleich in Deine Zwischenablage zu kopieren.

+
+
+
+
+
+ @if($homeparty_user->is_host) Gastgeber, @else Gast-, @endif Rechungsadresse +
+
+ * {{trans('register.required_fields')}} + Lieferadresse +
+
+
+ @include('user.homeparty._edit') +
+
+   + zurück zur Übersicht +
+ {!! Form::close() !!} + + + + +@endsection \ No newline at end of file diff --git a/resources/views/user/homeparty/guests.blade.php b/resources/views/user/homeparty/guests.blade.php new file mode 100644 index 00000000..9408ca47 --- /dev/null +++ b/resources/views/user/homeparty/guests.blade.php @@ -0,0 +1,109 @@ +@extends('layouts.layout-2') + +@section('content') +

+
{{ __('navigation.my_homeparty') }} / {{ $homeparty->name }} - {{ $homeparty->date }}
+   Neue Gast anlegen +

+ +
+
+ @php($g_count = 1) + + @foreach($homeparty->homeparty_users as $homeparty_user) +
+ +
+
+
+
+ {{$homeparty->description}} +
+
+
+
+
Adresse
+
{{$homeparty_user->billing_address}} + {{$homeparty_user->billing_zipcode}} + {{$homeparty_user->city}} + @if($homeparty_user->billing_country_id){{ $homeparty_user->billing_country->getLocated() }}@endif +
+
+
+
E-Telefon
+
{{$homeparty_user->billing_phone}}
+
+
+
E-Mail
+
{{$homeparty_user->billing_email}}
+
+
+
+
+
+
+
+ + + + +
+
+
+
+ @endforeach +
+
+ zurück zur Übersicht + +@endsection \ No newline at end of file diff --git a/resources/views/user/homeparty/index.blade.php b/resources/views/user/homeparty/index.blade.php new file mode 100644 index 00000000..5bd2ae5d --- /dev/null +++ b/resources/views/user/homeparty/index.blade.php @@ -0,0 +1,79 @@ +@extends('layouts.layout-2') + +@section('content') +

+
{{ __('navigation.my_homeparty') }} / {{ __('navigation.overview') }}
+   Neue Homeparty anlegen +

+ +
+
+ + @foreach($homepartys as $homeparty) +
+
+
+ {{$homeparty->name}} + {{-- offen ... --}} +
+
+ + +
+
+
+
+
+
+ {{$homeparty->description}} +
+
+
+
+
Datum
+
{{$homeparty->date}}
+
+
+
Ort
+
{{$homeparty->place}}
+
+
+
Gäste
+
{{$homeparty->homeparty_guests->count()}}
+
+
+
Umsatz
+
0
+
+
+
Points
+
0
+
+
+
+
+ +
+ @endforeach +
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/user/homeparty/self_guest_detail.blade.php b/resources/views/user/homeparty/self_guest_detail.blade.php new file mode 100644 index 00000000..189e4b4f --- /dev/null +++ b/resources/views/user/homeparty/self_guest_detail.blade.php @@ -0,0 +1,134 @@ +@extends('layouts.layout-2-without') + +@section('content') +

+
Homeparty / {{ $homeparty->name }} - {{ $homeparty->date }}
+ zurück +

+ + {!! Form::open(['url' => route('homeparty', [$homeparty_user->token]), 'class' => 'form-horizontal', 'id'=>'homeparty-user-form-validation']) !!} +
+ @if(Session::has('alert-save')) + +
+
+ {{__('saved')}}: {{__('The changes have been saved.')}} +
+
+ @endif +
+
+
Eingabe Deiner persönlichen Daten für die Homeparty
+
+
+
+
+
+ @if($homeparty_user->is_host) Gastgeber, @else Gast-, @endif Rechungsadresse +
+
+ * {{trans('register.required_fields')}} + Lieferadresse +
+
+
+ @include('user.homeparty._edit') +
+
+
+ +
+
+
+
+   +
+ {!! Form::close() !!} + + +@endsection \ No newline at end of file diff --git a/resources/views/user/order/_bak_shipping_me.blade.php b/resources/views/user/order/_bak_shipping_me.blade.php index 8fa8aede..ada4e53c 100644 --- a/resources/views/user/order/_bak_shipping_me.blade.php +++ b/resources/views/user/order/_bak_shipping_me.blade.php @@ -135,8 +135,8 @@ @endif
- - {{ Form::text('shipping_lastname', $user->account->shipping_lastname, array('placeholder'=>__('Last Name'), 'class'=>'form-control', 'required'=>true)) }} + + {{ Form::text('shipping_lastname', $user->account->shipping_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true)) }} @if ($errors->has('shipping_lastname')) {{ $errors->first('shipping_lastname') }} diff --git a/resources/views/user/order/_bak_shipping_ot.blade.php b/resources/views/user/order/_bak_shipping_ot.blade.php index 1bcdcfc5..620bf938 100644 --- a/resources/views/user/order/_bak_shipping_ot.blade.php +++ b/resources/views/user/order/_bak_shipping_ot.blade.php @@ -133,8 +133,8 @@ @endif
- - {{ Form::text('shipping_lastname', $shopping_user->shipping_lastname, array('placeholder'=>__('Last Name'), 'class'=>'form-control', 'required'=>true)) }} + + {{ Form::text('shipping_lastname', $shopping_user->shipping_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true)) }} @if ($errors->has('shipping_lastname')) {{ $errors->first('shipping_lastname') }} diff --git a/resources/views/user/team/members.blade.php b/resources/views/user/team/members.blade.php index bea7a5cf..6aac39ae 100644 --- a/resources/views/user/team/members.blade.php +++ b/resources/views/user/team/members.blade.php @@ -33,7 +33,6 @@

Du möchtest einen neuen Berater registrieren? Super, das freut uns. Sende ihm einfach nachfolgenden Link per Mail, WhatsApp oder SMS zu. Er gelangt damit auf die Registrierungsseite von www.mivita.care. Wichtig ist, dass Du diesen Link nicht veränderst, denn die angehängte Berater-ID identifiziert Dich als Sponsor von dem neuen Berater. Nur so können Dir künftige Provisionen durch Umsätze von ihm zugeordnet werden. Nutze das „Kopier-Symbol“, um den Link gleich in Deine Zwischenablage zu kopieren. -