1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Create client logo's

This commit is contained in:
David Bomba 2019-08-26 19:28:21 +10:00
parent 263b4896dc
commit d50cab40c2
6 changed files with 36 additions and 36 deletions

View File

@ -70,19 +70,6 @@ class ProfileController extends Controller
if($request->input('password')) if($request->input('password'))
$client_contact->password = Hash::make($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(); $client_contact->save();
// auth()->user()->fresh(); // auth()->user()->fresh();
@ -95,6 +82,16 @@ class ProfileController extends Controller
$client = $client_contact->client; $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->fill($request->all());
$client->save(); $client->save();

View File

@ -33,7 +33,8 @@ class UpdateClientRequest extends Request
{ {
return [ return [
'name' => 'required' 'name' => 'required',
'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp'
]; ];
} }

View File

@ -38,7 +38,6 @@ class UpdateContactRequest extends Request
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required|email|unique:client_contacts,email,' . auth()->user()->id, 'email' => 'required|email|unique:client_contacts,email,' . auth()->user()->id,
'password' => 'sometimes|nullable|min:6|confirmed', 'password' => 'sometimes|nullable|min:6|confirmed',
'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp'
]; ];
} }

View File

@ -263,6 +263,7 @@ class CreateUsersTable extends Migration
$table->string('website')->nullable(); $table->string('website')->nullable();
$table->text('private_notes')->nullable(); $table->text('private_notes')->nullable();
$table->text('client_hash')->nullable(); $table->text('client_hash')->nullable();
$table->string('logo', 255)->nullable();
$table->decimal('balance', 13, 2)->nullable(); $table->decimal('balance', 13, 2)->nullable();
$table->decimal('paid_to_date', 13, 2)->nullable(); $table->decimal('paid_to_date', 13, 2)->nullable();

View File

@ -4,7 +4,7 @@
{!! Former::framework('TwitterBootstrap4'); !!} {!! Former::framework('TwitterBootstrap4'); !!}
{!! Former::horizontal_open() {!! Former::horizontal_open_for_files()
->id('update_settings') ->id('update_settings')
->route('client.profile.edit_client', auth()->user()->hashed_id) ->route('client.profile.edit_client', auth()->user()->hashed_id)
->method('PUT'); !!} ->method('PUT'); !!}
@ -22,9 +22,28 @@
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-sm-4">
<div class="card align-items-center">
<div class="card-body">
@if(auth()->user()->client->logo)
<img src="{{ auth()->user()->client->logo }}" class="img-fluid">
@else
<i class="fa fa-user fa-5x"></i>
@endif
{!! Former::file('logo')
->max(2, 'MB')
->accept('image')
->label('')
->inlineHelp(trans('texts.logo_help')) !!}
</div>
</div>
</div>
<div class="col-sm-6 pull-left"> <div class="col-sm-6 pull-left">
{!! Former::text('name')->label( ctrans('texts.name')) !!} <div class="card card-body">
{!! Former::text('website')->label( ctrans('texts.website')) !!} {!! Former::text('name')->label( ctrans('texts.name')) !!}
{!! Former::text('website')->label( ctrans('texts.website')) !!}
</div>
</div> </div>
</div> </div>

View File

@ -15,7 +15,7 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<strong> {{ ctrans('texts.user_details') }}</strong> <strong> {{ ctrans('texts.details') }}</strong>
</div> </div>
{!! Former::framework('TwitterBootstrap4'); !!} {!! Former::framework('TwitterBootstrap4'); !!}
@ -30,23 +30,6 @@
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-sm-4">
<div class="card align-items-center">
<div class="card-body">
@if(auth()->user()->avatar)
<img src="{{ auth()->user()->avatar }}" class="img-fluid">
@else
<i class="fa fa-user fa-5x"></i>
@endif
{!! Former::file('avatar')
->max(2, 'MB')
->accept('image')
->label('')
->inlineHelp(trans('texts.logo_help')) !!}
</div>
</div>
</div>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">