diff --git a/code/app/Http/Controllers/UsersController.php b/code/app/Http/Controllers/UsersController.php index 17870b3b..c0d3a91e 100644 --- a/code/app/Http/Controllers/UsersController.php +++ b/code/app/Http/Controllers/UsersController.php @@ -58,8 +58,8 @@ public function revisioned(Request $request, $id) public function promote(Request $request, $id) { - return $this->easyExecute(function() use ($id) { - $subject = $this->service->promoteFriend($id); + return $this->easyExecute(function() use ($id, $request) { + $subject = $this->service->promoteFriend($request->all(), $id); return $this->commonSuccessResponse($subject); }); } diff --git a/code/app/Models/Concerns/ContactableTrait.php b/code/app/Models/Concerns/ContactableTrait.php index a1f2f66a..afe15127 100644 --- a/code/app/Models/Concerns/ContactableTrait.php +++ b/code/app/Models/Concerns/ContactableTrait.php @@ -16,7 +16,7 @@ trait ContactableTrait { public function contacts(): MorphMany { - return $this->morphMany('App\Contact', 'target'); + return $this->morphMany(Contact::class, 'target'); } public function updateContacts($request) diff --git a/code/app/Services/UsersService.php b/code/app/Services/UsersService.php index 64186ffc..c0df3f66 100644 --- a/code/app/Services/UsersService.php +++ b/code/app/Services/UsersService.php @@ -284,7 +284,7 @@ public function revisioned($id, $approved) DB::commit(); } - public function promoteFriend($id) + public function promoteFriend($request, $id) { $admin = $this->ensureAuth(['users.admin' => 'gas']); @@ -299,6 +299,11 @@ public function promoteFriend($id) $user->parent_id = null; $user->save(); + $email = $request['email'] ?? null; + if ($email) { + $user->addContact('email', $email); + } + return $user; } diff --git a/code/resources/views/commons/columns.blade.php b/code/resources/views/commons/columns.blade.php new file mode 100644 index 00000000..80a22fe9 --- /dev/null +++ b/code/resources/views/commons/columns.blade.php @@ -0,0 +1,16 @@ +
+ + +
diff --git a/code/resources/views/order/summary.blade.php b/code/resources/views/order/summary.blade.php index 8d9470f1..4514d2fa 100644 --- a/code/resources/views/order/summary.blade.php +++ b/code/resources/views/order/summary.blade.php @@ -54,22 +54,12 @@ -
- - -
  + @include('commons.columns', [ + 'columns' => $columns, + 'display_columns' => $display_columns, + ]) + +   @include('commons.iconslegend', [ 'class' => App\Product::class, diff --git a/code/resources/views/order/summary_ro.blade.php b/code/resources/views/order/summary_ro.blade.php index cc1cb236..bbbaa8ef 100644 --- a/code/resources/views/order/summary_ro.blade.php +++ b/code/resources/views/order/summary_ro.blade.php @@ -34,22 +34,10 @@ -
- - -
+ @include('commons.columns', [ + 'columns' => $columns, + 'display_columns' => $display_columns, + ]) diff --git a/code/resources/views/user/edit.blade.php b/code/resources/views/user/edit.blade.php index ce4205bf..60ccdf33 100644 --- a/code/resources/views/user/edit.blade.php +++ b/code/resources/views/user/edit.blade.php @@ -22,7 +22,7 @@ $friend_admin_buttons = [ [ 'label' => _i('Modifica Amico'), - 'classes' => ['float-start', 'prevent-default'], + 'classes' => ['float-start', 'prevent-default', 'me-2'], 'attributes' => ['data-bs-toggle' => 'modal', 'data-bs-target' => '#change_friend_' . $user->id] ] ]; @@ -165,6 +165,11 @@

{{ _i('Cliccando "Salva", questo utente diventerà un utente regolare. Gli sarà assegnato il ruolo %s, avrà una propria contabilità, e non potrà più essere amministrato da %s. Sarà preservato lo storico delle sue prenotazioni, ma tutti i suoi pagamenti pregressi resteranno addebitati a %s.', roleByIdentifier('user')->name, $user->parent->printableName(), $user->parent->printableName()) }}

+ + @if(blank($user->email)) +
+ + @endif