diff --git a/app/Http/Controllers/ClientPortal/ProfileController.php b/app/Http/Controllers/ClientPortal/ProfileController.php index d16ba037662f..79b0f44cf72f 100644 --- a/app/Http/Controllers/ClientPortal/ProfileController.php +++ b/app/Http/Controllers/ClientPortal/ProfileController.php @@ -70,19 +70,6 @@ class ProfileController extends Controller if($request->input('password')) $client_contact->password = Hash::make($request->input('password')); - //update avatar if needed - if($request->file('avatar')) - { - $path = UploadAvatar::dispatchNow($request->file('avatar'), auth()->user()->client->client_hash); - - if($path) - { - $client_contact->avatar = $path; - $client_contact->avatar_size = $request->file('avatar')->getSize(); - $client_contact->avatar_type = $request->file('avatar')->getClientOriginalExtension(); - } - } - $client_contact->save(); // auth()->user()->fresh(); @@ -95,6 +82,16 @@ class ProfileController extends Controller $client = $client_contact->client; + //update avatar if needed + if($request->file('logo')) + { + $path = UploadAvatar::dispatchNow($request->file('logo'), auth()->user()->client->client_hash); + + if($path) + $client->logo = $path; + + } + $client->fill($request->all()); $client->save(); diff --git a/app/Http/Requests/ClientPortal/UpdateClientRequest.php b/app/Http/Requests/ClientPortal/UpdateClientRequest.php index dc785889fc64..563b980af206 100644 --- a/app/Http/Requests/ClientPortal/UpdateClientRequest.php +++ b/app/Http/Requests/ClientPortal/UpdateClientRequest.php @@ -33,7 +33,8 @@ class UpdateClientRequest extends Request { return [ - 'name' => 'required' + 'name' => 'required', + 'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp' ]; } diff --git a/app/Http/Requests/ClientPortal/UpdateContactRequest.php b/app/Http/Requests/ClientPortal/UpdateContactRequest.php index 1fbc67cb66c8..bd07dd11dd85 100644 --- a/app/Http/Requests/ClientPortal/UpdateContactRequest.php +++ b/app/Http/Requests/ClientPortal/UpdateContactRequest.php @@ -38,7 +38,6 @@ class UpdateContactRequest extends Request 'last_name' => 'required', 'email' => 'required|email|unique:client_contacts,email,' . auth()->user()->id, 'password' => 'sometimes|nullable|min:6|confirmed', - 'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp' ]; } diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 6d2e293c91c5..65ffcbe9bf4b 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -263,6 +263,7 @@ class CreateUsersTable extends Migration $table->string('website')->nullable(); $table->text('private_notes')->nullable(); $table->text('client_hash')->nullable(); + $table->string('logo', 255)->nullable(); $table->decimal('balance', 13, 2)->nullable(); $table->decimal('paid_to_date', 13, 2)->nullable(); diff --git a/resources/views/portal/default/profile/client_information.blade.php b/resources/views/portal/default/profile/client_information.blade.php index 9b1d99368350..c04e69346009 100644 --- a/resources/views/portal/default/profile/client_information.blade.php +++ b/resources/views/portal/default/profile/client_information.blade.php @@ -4,7 +4,7 @@ {!! Former::framework('TwitterBootstrap4'); !!} - {!! Former::horizontal_open() + {!! Former::horizontal_open_for_files() ->id('update_settings') ->route('client.profile.edit_client', auth()->user()->hashed_id) ->method('PUT'); !!} @@ -22,9 +22,28 @@
+
+
+
+ @if(auth()->user()->client->logo) + + @else + + @endif + + {!! Former::file('logo') + ->max(2, 'MB') + ->accept('image') + ->label('') + ->inlineHelp(trans('texts.logo_help')) !!} +
+
+
- {!! Former::text('name')->label( ctrans('texts.name')) !!} - {!! Former::text('website')->label( ctrans('texts.website')) !!} +
+ {!! Former::text('name')->label( ctrans('texts.name')) !!} + {!! Former::text('website')->label( ctrans('texts.website')) !!} +
diff --git a/resources/views/portal/default/profile/index.blade.php b/resources/views/portal/default/profile/index.blade.php index 9b6cb72b03ed..885e2f9c6ad9 100644 --- a/resources/views/portal/default/profile/index.blade.php +++ b/resources/views/portal/default/profile/index.blade.php @@ -15,7 +15,7 @@
- {{ ctrans('texts.user_details') }} + {{ ctrans('texts.details') }}
{!! Former::framework('TwitterBootstrap4'); !!} @@ -30,23 +30,6 @@
-
-
-
- @if(auth()->user()->avatar) - - @else - - @endif - - {!! Former::file('avatar') - ->max(2, 'MB') - ->accept('image') - ->label('') - ->inlineHelp(trans('texts.logo_help')) !!} -
-
-